commons-dbcp bundle used in camel feature.xml doesn't allow dynamic imports
---------------------------------------------------------------------------
Key: CAMEL-4308
URL: https://issues.apache.org/jira/browse/CAMEL-4308
Project: Camel
Issue Type: Improvement
Reporter: Freeman Fang
currently the commons-dbcp bundle used in camel feature.xml doesn't allow
dynamic imports, it will cause exception like
org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class
'oracle.jdbc.driver.OracleDriver'
as
JDBC driver class not found actually is a common issue in OSGi container, this
problem generally from a bundle(let's say it bundle A, commons-dbcp in this
case) 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, we'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 we can't add correct
package import when we generate bundle A.
The general solution is
1. add dynamic import for bundle A(commons-dbcp)
or
2. 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.
Solution 1 left less effort for end user and n servicemix wrapped commons-dbcp
bundle we already have dynamic-import header and I think camel features should
use the servicemix wrapped commons-dbcp bundle as well.
I will append a patch soon.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira