I suspect more an issue in the datasource XML.
Let me check.

Regards
JB

On 12/24/2014 01:36 PM, Richard Snowden wrote:
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]
<mailto:[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>
        <http://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
        <http://0e7ff672d27a.info>(Unknown Source)
                  at Proxy413bb2d4_9950_4f87_97c3___3ddf66300a75.info
        <http://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]>
        <mailto:[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]>>
                 <mailto:[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]>>
                 <mailto:richard.t.snowden@
        <mailto:richard.t.snowden@>__gm__ail.com <http://gmail.com>
                 <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]>>
                 <mailto:[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]>>
                 <mailto:[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]>
        <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