Hi Matt,
I got around the problem.
Background:
I am using Maven 2 with vendor provided JCE jars installed in jre/lib/ext. The
IsolatedClassloader of the Surefire plugin was not finding the JCE classes
and reporting NoClassDefFoundErrors when running Junit tests.
I tried to configure the maven-surefire-plugin to use the system classloader
by adding the following to my pom.xml:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>*maven-surefire-plugin*</artifactId>
<configuration>
<!--childDelegation>false</childDelegation-->
*<useSystemClassLoader>true</useSystemClassLoader>*
</configuration>
</plugin>
When I tried using <useSystemClassloader>true</useSystemClassloader>, I was
hoping surefire would find the classes in jre/lib/ext however I got
a NoClassDefFound on the SurefireBooter as follows (surefire bug):
[INFO] Building jar: c:\temp\surefirebooter37241.jar
java.lang.NoClassDefFoundError:
org/apache/maven/surefire/booter/SurefireBooter
Exception in thread "main"
I eventually took all of the JCE provider jars out of jre/lib/ext because I
am using JDK1.5 and put the jar files as dependencies using "system" as the
scope in Maven. Adding the following to pom.xml:
<dependency>
<groupId>com.ingrian</groupId>
<artifactId>nae.provider</artifactId>
*<scope>system</scope> **
<systemPath>C:\work\path\to\jar\IngrianNAE.jar</systemPath>
*</dependency>
<dependency>
<groupId>cryptix</groupId>
<artifactId>cryptix</artifactId>
* <scope>system</scope>
**<systemPath>C:\work\path\to\jar\cryptix-jce-api.jar
</systemPath>
*</dependency>
In this way I don't have to set useSystemClassloader = true and the tests move
farther.
Regards,
Abe
On 7/24/07, Matt Raible <[EMAIL PROTECTED]> wrote:
Unfortunately, I don't know how to solve this. I generally try to keep
jre/lib/ext clean. The fact that a vendor *requires* you to put it's
JARs there seems strange to me. The only reason I can think of is
they're tired of telling customers how to modify their classpath - or
they need their JARs to load first (which should be able to be
controlled by the CLASSPATH as well).
You might try asking surefire-specific questions on the Maven user mailing
list.
Matt
On 7/23/07, Developer Abe <[EMAIL PROTECTED]> wrote:
> I am working with a set of jar files which have to be installed in
> jre/lib/ext
>
> One of the vendors jar files is a version of log4j.
>
> I was wondering how to configure the
> <useSystemClassLoader>true</useSystemClassLoader>
> attribute for the surefire plugin in appfuse.
>
> I tried adding the vendor's log4j jar to the maven repository and
> dependencies section of my pom.xml because I was originally getting a
bunch
> of NoClassDefFoundErrors because Maven could not find the classes in the
jar
> files in jre/lib/ext. I have a feeling it has to do with surefire's
> IsolatedClassLoader.
>
> When I added the dependencies manually I am getting errors related to
not
> finding properties files and not being able to assign one class loaded
by
> the SystemExt loader to surefire's Isolated class loader.
>
> I am hoping to get surefire to use the system class loader and remove
the
> dependencies in my pom.xml.
>
> Does anyone know how to set the
> <useSystemClassLoader>true</useSystemClassLoader> attribute
> in appfuse.
>
> Regards,
> Abe
>
>
--
http://raibledesigns.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]