Yes, as the classloaders is not the same in OSGi.

Try to use a TCCL and check your import package.

Regards
JB

On 12/23/2014 03:45 PM, Richard Snowden 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]>> 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]>
    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