I have built a bundle for Karaf with maven, and I included the org.postgresql
dependency with
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.4-1201-jdbc41</version>
</dependency>
I also included the jar of the latest version to Karaf's lib/ext/
directory.
The bundle is loaded correctly. However, at runtime, when the bundle tries to load the driver with:
Class.forName("org.postgresql.Driver");
I get the following error:
2015-05-28 14:36:07,218 | ERROR | qtp1270203840-47 | MyBundleServlet | 124 - MyBundle - 1.0.0.SNAPSHOT | org.postgresql.Driver not found by MyBundle [124]
java.lang.ClassNotFoundException: org.postgresql.Driver not found by MyBundle [124]
at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1532)[org.apache.felix.framework-4.2.1.jar:]
at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75)[org.apache.felix.framework-4.2.1.jar:]
at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1955)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)[:1.7.0_75]
at java.lang.Class.forName0(Native Method)[:1.7.0_75]
at java.lang.Class.forName(Class.java:191)[:1.7.0_75]
...
Is there anything more I have to add?