Re: Karaf 3.0.2: Adding H2 Database support

2014-12-24 Thread Jean-Baptiste Onofré
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

Re: Karaf 3.0.2: Adding H2 Database support

2014-12-24 Thread Richard Snowden
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é wrote: > Hi Richard, > > Can

Re: Karaf 3.0.2: Adding H2 Database support

2014-12-23 Thread Jean-Baptiste Onofré
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

Re: Karaf 3.0.2: Adding H2 Database support

2014-12-23 Thread Richard Snowden
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.kara

Re: Karaf 3.0.2: Adding H2 Database support

2014-12-23 Thread Jean-Baptiste Onofré
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

Re: Karaf 3.0.2: Adding H2 Database support

2014-12-23 Thread Richard Snowden
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 wrote: > It is "wrong" but more work to manage imports and drivers especially if > you need to optionally support multiple databases. It i

Re: Karaf 3.0.2: Adding H2 Database support

2014-12-23 Thread Kevin Schmidt
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" wrote: > I just tried Derby - got the same issue: > ja

Re: Karaf 3.0.2: Adding H2 Database support

2014-12-23 Thread Jean-Baptiste Onofré
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 ini

Re: Karaf 3.0.2: Adding H2 Database support

2014-12-23 Thread Richard Snowden
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:me

Re: Karaf 3.0.2: Adding H2 Database support

2014-12-23 Thread Jean-Baptiste Onofré
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: Wh

Karaf 3.0.2: Adding H2 Database support

2014-12-23 Thread Richard Snowden
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.ClassNotF