Hi,

This is actually a common issue when use JDBC driver in OSGi container, in your case, it's because spring-jdbc bundle didn't import org.postgresql driver package beforehand but try to use class.forname() method to init it, hence you see such this exception.

This problem generally from a bundle(let's say it bundle A) using some code like classForName(jdbc_driver_classname) to init a jdbc driver class, this is a big problem in OSGi world, as if BundleA not import package for jdbc_driver_classname, you'll see the problem. However BundleA actually can't know about package name for jdbc_driver_classname beforehand, as the jdbc_driver_classname generally is passed in through configuration during runtime, it can't be determined during build time, so you can't add correct package import when you generate bundle A.

The general solution for this issue is that
Option1.you create JDBC driver as a fragment bundle, and attach it to bundle A(bundle A is host bundle now), so that all resource from fragment bundle is available for the host bundle.
or
Option2. enable dynamic import for bundle A

Also you can try with Achim's suggestion which just pass in a object, but not a classname which avoid the class.forname() thing here.

You can find more details from link [1] and [2]

[1]http://fusesource.com/forums/thread.jspa?messageID=12519
[2]http://fusesource.com/forums/thread.jspa?messageID=9780

Freeman
On 2011-11-16, at 上午7:09, bmccabe wrote:

Thanks, I'm not familiar with that, so I'll look into it.
Bill

--
View this message in context: 
http://servicemix.396122.n5.nabble.com/Blueprint-postgresql-camel-jdbc-newbie-question-tp4994862p4996103.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

---------------------------------------------
Freeman Fang

FuseSource
Email:[email protected]
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com









Reply via email to