Yes, the H2 bundle is installed (has been automatically installed by
"jdbc:create
-t h2 -u test2 -i test2").

By the way: I also get this error when using Postgres. Only Derby seems to
work with "jdbc:create ...".

On Wed, Dec 24, 2014 at 8:04 AM, Jean-Baptiste Onofré <[email protected]>
wrote:

> Hi Richard,
>
> Can you check (with la command) that the H2 bundle is installed ?
>
> Regards
> JB
>
> On 12/23/2014 10:03 PM, Richard Snowden wrote:
>
>> OK, this seems to work for Derby.
>> feature:install jdbc
>> jdbc:create -t derby -u test -i test
>>
>>
>> But when I do the same for H2  ...
>> jdbc:create -t h2 -u test2 -i test2
>>
>> ... I get this error:
>>
>>
>> 2014-12-23 21:57:44,854 | ERROR | l for user karaf |
>> JdbcServiceImpl                  | 245 - org.apache.karaf.jdbc.core -
>> 3.0.2 | Can't get information about datasource jdbc/test2
>> java.sql.SQLException: No suitable driver found for null
>>          at
>> org.h2.jdbcx.JdbcDataSource.getJdbcConnection(JdbcDataSource.java:183)
>>          at
>> org.h2.jdbcx.JdbcDataSource.getConnection(JdbcDataSource.java:156)
>>          at
>> Proxy6eb370cb_8e6e_4d06_914b_aeae4440bd27.getConnection(Unknown Source)
>>          at
>> org.apache.karaf.jdbc.internal.JdbcConnector.
>> connect(JdbcConnector.java:52)
>>          at org.apache.karaf.jdbc.internal.JdbcServiceImpl.info
>> <http://org.apache.karaf.jdbc.internal.JdbcServiceImpl.info>
>> (JdbcServiceImpl.java:217)
>>
>>          at Proxy9daa3030_80a4_4467_9c66_0e7ff672d27a.info(Unknown
>> Source)
>>          at Proxy413bb2d4_9950_4f87_97c3_3ddf66300a75.info(Unknown
>> Source)
>>          at
>> org.apache.karaf.jdbc.command.DataSourcesCommand.doExecute(
>> DataSourcesCommand.java:40)
>>          at
>> org.apache.karaf.shell.console.AbstractAction.
>> execute(AbstractAction.java:33)[25:org.apache.karaf.shell.console:3.0.2]
>>          at
>> org.apache.karaf.shell.console.OsgiCommandSupport.
>> execute(OsgiCommandSupport.java:39)[25:org.apache.karaf.
>> shell.console:3.0.2]
>>          at
>> org.apache.karaf.shell.commands.basic.AbstractCommand.execute(
>> AbstractCommand.java:33)[25:org.apache.karaf.shell.console:3.0.2]
>>          at Proxy7a296bd8_2a11_49a3_a5a4_e913fe60ec5f.execute(Unknown
>> Source)[:]
>>          at Proxy7a296bd8_2a11_49a3_a5a4_e913fe60ec5f.execute(Unknown
>> Source)[:]
>>          at
>> org.apache.felix.gogo.runtime.CommandProxy.execute(
>> CommandProxy.java:78)[25:org.apache.karaf.shell.console:3.0.2]
>>          at
>> org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.
>> java:477)[25:org.apache.karaf.shell.console:3.0.2]
>>          at
>> org.apache.felix.gogo.runtime.Closure.executeStatement(
>> Closure.java:403)[25:org.apache.karaf.shell.console:3.0.2]
>>          at
>> org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)[25:
>> org.apache.karaf.shell.console:3.0.2]
>>          at
>> org.apache.felix.gogo.runtime.Closure.execute(Closure.java:
>> 183)[25:org.apache.karaf.shell.console:3.0.2]
>>          at
>> org.apache.felix.gogo.runtime.Closure.execute(Closure.java:
>> 120)[25:org.apache.karaf.shell.console:3.0.2]
>>          at
>> org.apache.felix.gogo.runtime.CommandSessionImpl.execute(
>> CommandSessionImpl.java:92)
>>          at
>> org.apache.karaf.shell.console.impl.jline.ConsoleImpl.run(ConsoleImpl.
>> java:203)
>>          at
>> org.apache.karaf.shell.console.impl.jline.LocalConsoleManager$2$1$1.run(
>> LocalConsoleManager.java:115)
>>          at java.security.AccessController.doPrivileged(Native
>> Method)[:1.7.0_60]
>>          at
>> org.apache.karaf.jaas.modules.JaasHelper.doAs(JaasHelper.
>> java:57)[26:org.apache.karaf.jaas.modules:3.0.2]
>>          at
>> org.apache.karaf.shell.console.impl.jline.LocalConsoleManager$2$1.run(
>> LocalConsoleManager.java:108)[25:org.apache.karaf.shell.console:3.0.2]
>>
>> On Tue, Dec 23, 2014 at 4:04 PM, Jean-Baptiste Onofré <[email protected]
>> <mailto:[email protected]>> wrote:
>>
>>     Thread Context Class Loader: Thread.currentThread.__getClassLoader()
>>     / setClassLoader(). Like this, if you have the correct
>>     Import-Package, you can "gather" the classloaders.
>>
>>     Anyway, even for a demo, you can do:
>>
>>     feature:install jdbc
>>     jdbc:create to create a datasource
>>
>>     and just use the datasource via the OSGi service or the JNDI name.
>>
>>     Regards
>>     JB
>>
>>     On 12/23/2014 04:00 PM, Richard Snowden wrote:
>>
>>         I won't support multiple databases (it's only for a demo) - so a
>>         quick &
>>         dirty solution is OK.
>>
>>         What's a TCCL?
>>
>>         On Tue, Dec 23, 2014 at 3:53 PM, Kevin Schmidt
>>         <[email protected] <mailto:[email protected]>
>>         <mailto:[email protected] <mailto:[email protected]>>> wrote:
>>
>>              It is "wrong" but more work to manage imports and drivers
>>         especially
>>              if you need to optionally support multiple databases. It is
>>         cleaner
>>              to configure a data source and just look it up from your
>> code.
>>
>>              On Dec 23, 2014 6:45 AM, "Richard Snowden"
>>              <[email protected]
>>         <mailto:[email protected]>
>>         <mailto:richard.t.snowden@__gmail.com
>>         <mailto:[email protected]>>>
>>              wrote:
>>
>>                  I just tried Derby - got the same issue:
>>                  java.lang.__ClassNotFoundException:
>>                  org.apache.derby.jdbc.__EmbeddedDriver
>>
>>                  This is what I do to initialize the DB:
>>                  Derby:
>>
>>
>>         Class.forName("org.apache.__derby.jdbc.EmbeddedDriver").__
>> newInstance();
>>                               dbConnection =
>>
>>         DriverManager.getConnection("__jdbc:derby:memory:myDB;
>> create=__true;");
>>
>>                  H2:
>>                               Class.forName("org.h2.Driver")__;
>>                               dbConnection =
>>                  DriverManager.getConnection("__jdbc:h2:~/myDB", "", "");
>>
>>                  Is this wrong?
>>
>>                  On Tue, Dec 23, 2014 at 3:37 PM, Jean-Baptiste Onofré
>>                  <[email protected] <mailto:[email protected]>
>>         <mailto:[email protected] <mailto:[email protected]>>> wrote:
>>
>>                      Hi Richard,
>>
>>                      I suspect more an issue in the way that you use the
>> h2
>>                      package in your application.
>>
>>                      Do you have h2 package in Import-Package of your
>>         application ?
>>                      How do you use the driver ? Class.forName() ?
>>                      Do you use a datasource ?
>>
>>                      Regards
>>                      JB
>>
>>
>>                      On 12/23/2014 03:31 PM, Richard Snowden wrote:
>>
>>                          What I did:
>>
>>                          - added H2 Database to my application. It works
>>         fine
>>                          outside of Karaf.
>>
>>                          - installed H2 to Karaf with "install -s
>>                          mvn:com.h2database/h2/1.4.184"
>>
>>                          I can see the H2 bundle as "Active" (H2
>>         Database Engine).
>>
>>                          But when I install my application bundle in
>>         Karaf, I get
>>                          this:
>>                          java.lang.____ClassNotFoundException:
>>         org.h2.Driver not found
>>
>>                          What's the proper way to install H2 to Karaf?
>>
>>
>>                      --
>>                      Jean-Baptiste Onofré
>>         [email protected] <mailto:[email protected]>
>>         <mailto:[email protected] <mailto:[email protected]>>
>>         http://blog.nanthrax.net
>>                      Talend - http://www.talend.com
>>
>>
>>
>>
>>     --
>>     Jean-Baptiste Onofré
>>     [email protected] <mailto:[email protected]>
>>     http://blog.nanthrax.net
>>     Talend - http://www.talend.com
>>
>>
>>
> --
> Jean-Baptiste Onofré
> [email protected]
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>

Reply via email to