You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Mike Van <mv...@comcast.net> on 2010/10/26 17:46:48 UTC
Karaf Spring C3P0 issue
All,
I posted this initially on the Springsource forums, as I'm using thier
bundles to implement Hibernate within Karaf. Unfortunately, there have been
not replies. Since this is also a Karaf issue, I thought I'd ask you folks
for some assistance also.
I'm deploying a bundle into Karaf 2.0.0 that makes use of Spring and C3P0
(the com.springsource version of C3P0), and I'm getting the following error:
com.springsource.com.mchange.v2.c3p0 - 0.9.1.2 | Could not load driverClass
oracle.jdbc.driver.OracleDriver.
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
at
org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:772)
at org.apache.felix.framework.ModuleImpl.access$200(ModuleImpl.java:73)
at
org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1685)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)[:1.6.0_18]
at java.lang.Class.forName0(Native Method)[1.6.0_18]
at java.lang.Class.forName(Class.java:169)[:1.6.0_18]
at
com.mchange.v2.c3p0.DriverManagerDataSource:ensureDriverLoaded(DriverManagerDataSource.java:100)[53:com.springsource.com.mchange.v2.c3p0:0.9.1.2]
Now, the bundle in question does import oracle.jdbc.driver.OracleDriver, and
in the MANIFEST.MF file "Dynamic-Import" is set to "*". Additionally, when I
run the following command inside of karaf:
osgi:list | grep oracle
the oracle.jdbc.driver package is available within Karaf.
Does anyone know what is going on here?
v/r,
Mike Van
--
View this message in context: http://karaf.922171.n3.nabble.com/Karaf-Spring-C3P0-issue-tp1774535p1774535.html
Sent from the Karaf - User mailing list archive at Nabble.com.
Re: Karaf Spring C3P0 issue
Posted by Mike Van <mv...@comcast.net>.
We have a "common" library where we export all of the necessary Oracle packages into the container. This is deployed prior to the bundle using hibernate. I wonder if this is a wiring issue, perhaps the bundle using hibernate isn't wiring to the Oracle package when it needs to.?? Dunno, its causing some major headaches though.
I've been looking into creating a fragment, but haven't seen any good tutorials on this. When you say " gather bundles in the same classloader", how would that work? I've seen this referenced in the past.
v/r,
Mike Van
----- Original Message -----
From: "Jean-Baptiste Onofré [via Karaf]" <ml...@n3.nabble.com>
To: "Mike Van" <mv...@comcast.net>
Sent: Tuesday, October 26, 2010 11:54:39 AM
Subject: Re: Karaf Spring C3P0 issue
Hi Mike,
I guess that you made a "wrapper" bundle for the Oracle JDBC driver.
Could you check if the JDBC driver is well deployed using osgi:list
command ?
A package:export command execution could be fine to see the exported
packages.
If the JDBC driver bundle is deployed, I think that the C3P0 code try
something like
Class.forName("oracle.jdbc.driver.OracleDriver").
The problem is the Oracle JDBC driver is certainly not in the class
classloader (due to OSGi "dynamism").
A possible workaround is to use Bundle Fragment to gather bundles in the
same classloader.
Regards
JB
On 10/26/2010 05:46 PM, Mike Van wrote:
>
> All,
>
> I posted this initially on the Springsource forums, as I'm using thier
> bundles to implement Hibernate within Karaf. Unfortunately, there have been
> not replies. Since this is also a Karaf issue, I thought I'd ask you folks
> for some assistance also.
>
> I'm deploying a bundle into Karaf 2.0.0 that makes use of Spring and C3P0
> (the com.springsource version of C3P0), and I'm getting the following error:
>
> com.springsource.com.mchange.v2.c3p0 - 0.9.1.2 | Could not load driverClass
> oracle.jdbc.driver.OracleDriver.
> java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
> at
> org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:772)
> at org.apache.felix.framework.ModuleImpl.access$200(ModuleImpl.java:73)
> at
> org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1685)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:248)[:1.6.0_18]
> at java.lang.Class.forName0(Native Method)[1.6.0_18]
> at java.lang.Class.forName(Class.java:169)[:1.6.0_18]
> at
> com.mchange.v2.c3p0.DriverManagerDataSource:ensureDriverLoaded(DriverManagerDataSource.java:100)[53:com.springsource.com.mchange.v2.c3p0:0.9.1.2]
>
> Now, the bundle in question does import oracle.jdbc.driver.OracleDriver, and
> in the MANIFEST.MF file "Dynamic-Import" is set to "*". Additionally, when I
> run the following command inside of karaf:
> osgi:list | grep oracle
>
> the oracle.jdbc.driver package is available within Karaf.
>
> Does anyone know what is going on here?
>
>
> v/r,
>
> Mike Van
View message @ http://karaf.922171.n3.nabble.com/Karaf-Spring-C3P0-issue-tp1774535p1774580.html
To start a new topic under Karaf - User, email ml-node+930749-917263437-228489@n3.nabble.com
To unsubscribe from Karaf - User, click here .
--
View this message in context: http://karaf.922171.n3.nabble.com/Karaf-Spring-C3P0-issue-tp1774535p1774668.html
Sent from the Karaf - User mailing list archive at Nabble.com.
Re: Karaf Spring C3P0 issue
Posted by Thiago Souza <tc...@gmail.com>.
Hi,
Another possible workaround is to use Spring's SimpleDriverDataSource to
directly instantiate an "unpooled" datasource and then instantiate a
"pooled" one through C3P0 DataSources' factory methods.
Regards
On Tue, Oct 26, 2010 at 13:57, Jean-Baptiste Onofré <jb...@nanthrax.net> wrote:
> Hi Mike,
>
> I guess that you made a "wrapper" bundle for the Oracle JDBC driver.
>
> Could you check if the JDBC driver is well deployed using osgi:list command
> ?
> A package:export command execution could be fine to see the exported
> packages.
>
> If the JDBC driver bundle is deployed, I think that the C3P0 code try
> something like
> Class.forName("oracle.jdbc.driver.OracleDriver").
>
> The problem is the Oracle JDBC driver is certainly not in the class
> classloader (due to OSGi "dynamism").
>
> A possible workaround is to use Bundle Fragment to gather bundles in the
> same classloader.
>
> Regards
> JB
>
>
>
> On 10/26/2010 05:46 PM, Mike Van wrote:
>
>>
>> All,
>>
>> I posted this initially on the Springsource forums, as I'm using thier
>> bundles to implement Hibernate within Karaf. Unfortunately, there have
>> been
>> not replies. Since this is also a Karaf issue, I thought I'd ask you
>> folks
>> for some assistance also.
>>
>> I'm deploying a bundle into Karaf 2.0.0 that makes use of Spring and C3P0
>> (the com.springsource version of C3P0), and I'm getting the following
>> error:
>>
>> com.springsource.com.mchange.v2.c3p0 - 0.9.1.2 | Could not load
>> driverClass
>> oracle.jdbc.driver.OracleDriver.
>> java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
>> at
>>
>> org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:772)
>> at org.apache.felix.framework.ModuleImpl.access$200(ModuleImpl.java:73)
>> at
>>
>> org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1685)
>> at java.lang.ClassLoader.loadClass(ClassLoader.java:248)[:1.6.0_18]
>> at java.lang.Class.forName0(Native Method)[1.6.0_18]
>> at java.lang.Class.forName(Class.java:169)[:1.6.0_18]
>> at
>>
>> com.mchange.v2.c3p0.DriverManagerDataSource:ensureDriverLoaded(DriverManagerDataSource.java:100)[53:com.springsource.com.mchange.v2.c3p0:0.9.1.2]
>>
>> Now, the bundle in question does import oracle.jdbc.driver.OracleDriver,
>> and
>> in the MANIFEST.MF file "Dynamic-Import" is set to "*". Additionally, when
>> I
>> run the following command inside of karaf:
>> osgi:list | grep oracle
>>
>> the oracle.jdbc.driver package is available within Karaf.
>>
>> Does anyone know what is going on here?
>>
>>
>> v/r,
>>
>> Mike Van
>>
>
Re: Karaf Spring C3P0 issue
Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Mike,
I guess that you made a "wrapper" bundle for the Oracle JDBC driver.
Could you check if the JDBC driver is well deployed using osgi:list
command ?
A package:export command execution could be fine to see the exported
packages.
If the JDBC driver bundle is deployed, I think that the C3P0 code try
something like
Class.forName("oracle.jdbc.driver.OracleDriver").
The problem is the Oracle JDBC driver is certainly not in the class
classloader (due to OSGi "dynamism").
A possible workaround is to use Bundle Fragment to gather bundles in the
same classloader.
Regards
JB
On 10/26/2010 05:46 PM, Mike Van wrote:
>
> All,
>
> I posted this initially on the Springsource forums, as I'm using thier
> bundles to implement Hibernate within Karaf. Unfortunately, there have been
> not replies. Since this is also a Karaf issue, I thought I'd ask you folks
> for some assistance also.
>
> I'm deploying a bundle into Karaf 2.0.0 that makes use of Spring and C3P0
> (the com.springsource version of C3P0), and I'm getting the following error:
>
> com.springsource.com.mchange.v2.c3p0 - 0.9.1.2 | Could not load driverClass
> oracle.jdbc.driver.OracleDriver.
> java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
> at
> org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:772)
> at org.apache.felix.framework.ModuleImpl.access$200(ModuleImpl.java:73)
> at
> org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1685)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:248)[:1.6.0_18]
> at java.lang.Class.forName0(Native Method)[1.6.0_18]
> at java.lang.Class.forName(Class.java:169)[:1.6.0_18]
> at
> com.mchange.v2.c3p0.DriverManagerDataSource:ensureDriverLoaded(DriverManagerDataSource.java:100)[53:com.springsource.com.mchange.v2.c3p0:0.9.1.2]
>
> Now, the bundle in question does import oracle.jdbc.driver.OracleDriver, and
> in the MANIFEST.MF file "Dynamic-Import" is set to "*". Additionally, when I
> run the following command inside of karaf:
> osgi:list | grep oracle
>
> the oracle.jdbc.driver package is available within Karaf.
>
> Does anyone know what is going on here?
>
>
> v/r,
>
> Mike Van