Unable to load Derby EmbeddedDriver even though it's in the classpath [message #831378] |
Wed, 28 March 2012 20:49 |
|
I created a Stardust utility project with a Maven configuration. The project is connected to a Dynamic Web Project in Eclipse (via Deployment Assembly) to deploy it on a local Tomcat instance.
When running JUnit tests inside the utility project which bootstrap an IPP engine, the Derby EmbeddedDriver cannot be found even though it's declared as a Maven dependency and it's definitely on the classpath:
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<version>${derby.version}</version>
<scope>test</scope>
</dependency>
In the log the following exceptions appear:
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.apache.derby.jdbc.EmbeddedDriver
...
Caused by: java.lang.SecurityException: sealing violation: package org.apache.derby.impl.store.raw.data is sealed
|
|
|
Re: Unable to load Derby EmbeddedDriver even though it's in the classpath [message #831382 is a reply to message #831378] |
Wed, 28 March 2012 20:56 |
|
The problem had to do with the fact that the utility project was also connected to the Dynamic Web Project (which was deployed on Tomcat) which automatically added an additional library entry ("Apache Tomcat 6.x") to the utility project.
Since the Dynamic Web Project is a Stardust RAD project, the Derby drivers were copied into the <tomcat>/common/lib directory in the server install directory as well.
Therefore I had two different Derby JARs on the classpath which explains the SecurityException.
Resolution:
Open the properties of the utility project, go to "Targeted Runtimes" and uncheck the target server (Apache Tomcat 6.x in my case) to remove the Tomcat libraries from the utility project's classpath.
|
|
|
|
Powered by
FUDForum. Page generated in 0.03695 seconds