Imagine situation: I have a main WAB which uses the separated c3p0-bundle like a connection pool. WAB doesn't just use c3p0 but customises its connection by WAB's class. To work properly, c3p0-bundle class loader has to obtain this WAB's class. To open access to WAB's classes for c3p0 I wrote "Require-Bundle: com.springsource.com.mchange.v2.c3p0" in the WAB's MANIFEST. This solution is successfully working with the hibernate bundle, but c3p0 can't find the required class.
Could not create for find ConnectionCustomizer with class name 'com.liferay.portal.dao.jdbc.pool.c3p0.PortalConnectionCustomizer'. org.eclipse.virgo.kernel.osgi.framework.ExtendedClassNotFoundException: com.liferay.portal.dao.jdbc.pool.c3p0.PortalConnectionCustomizer in KernelBundleClassLoader: [bundle=com.springsource.com.mchange.v2.c3p0_0.9.1.2]
I earlier just repacked the original c3p0-bundle to add Import of the required class package. This solution works but issues another kind of problem (http://www.eclipse.org/forums/index.php/mv/msg/452453/1006711/#msg_1006711). What is wrong in this situation with Require-bundle? Is there some other tricks to enforce the separated c3p0-bundle to find the required class inside main WAB?
What you want to do is to have a separate bundle that will publish a DataSource Service object, created with help of c3p0 or Apache BDCP. In your wab you import that DataSource service and use it without having to have a RequireBundle dependency on c3p0.
Services are much better way to organize your dependencies.