| <junit > fails when using JDK 1.4.2 but works with JDK 1.4.1? | <junit > fails when using JDK 1.4.2 but works with JDK 1.4.1? 2004-01-19 - By volker.augustin@(protected)
Hello,
I have the following directory structure:
c:\paramconv\ c:\paramconv\build c:\paramconv\src
The build file which can be found below works fine with JDK 1.4.1 and ant 1.5.3 or 1.6.0.
<project name="paramconv" default="compile" basedir="."> <property name="src" value="src" /> <property name="build" value="build" /> <property name="dist" value="dist" /> <property name="pack" value="pack" /> <property name="test.reports" value="reports" /> <property name="debug" value="true" />
<path id="project.class.path"> <pathelement path="${java.class.path}/" /> </path>
<path id="test.classpath"> <pathelement path="${java.class.path}/" /> <pathelement location="${build}" /> </path>
<target name="buildinit"> <mkdir dir="${build}" /> <copy file="resources/libraries/dflib.dll" todir="${build}" /> </target>
<target name="test" depends="compile" description="regression test - reports will be printed on the console"> <junit fork="yes" printsummary="no" haltonfailure="no"> <batchtest fork="yes" todir="${test.reports}" > <fileset dir="${build}"> <include name="**/*Test.class" /> </fileset> </batchtest> <formatter type="plain" usefile="false" /> <classpath refid="test.classpath" /> </junit> </target>
</project>
However, after switching to JDK 1.4.2, i couldn't run the test any more. After reading through the archive it seems the only way to solve this is to create c:\paramconv\jars and place junit.jar, ant-junit.jar and log4j-1.2.8.jar there. Moreover, I had to create an extra taskdef and disallow forking.
<taskdef name="junit" classname ="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"/>
<target name="test" depends="compile" description="regression test - reports will be printed on the console"> <junit fork="no" printsummary="no" haltonfailure="no"> <batchtest fork="no" todir="${test.reports}" > <fileset dir="${build}"> <include name="**/*Test.class" /> </fileset> </batchtest> <formatter type="plain" usefile="false" /> <classpath refid="test.classpath" /> </junit> </target>
Now, the tests are found (though I do not really like that solution). However, the classes which are tested load a library dflib.dll from either c:\winnt\dflib.dll or the local directory (which is c:\paramconv\build) when the test is run. And this library can now be loaded during the first test. But when the second test starts, this fails with the following exception:
[junit] java.lang.UnsatisfiedLinkError: Native Library C: \WINNT\dflib.dll already loaded in another classloader [junit] at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1525) [junit] at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1485) [junit] at java.lang.Runtime.loadLibrary0(Runtime.java:788) [junit] at java.lang.System.loadLibrary(System.java:834) [junit] at lib.dflib.<clinit>(dflib.java:48) .... [junit] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [junit] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [junit] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl .java:25) [junit] at java.lang.reflect.Method.invoke(Method.java:324) [junit] at junit.framework.TestCase.runTest(TestCase.java:154) [junit] at junit.framework.TestCase.runBare(TestCase.java:127) [junit] at junit.framework.TestResult$1.protect(TestResult.java:106) [junit] at junit.framework.TestResult.runProtected(TestResult.java:124) [junit] at junit.framework.TestResult.run(TestResult.java:109) [junit] at junit.framework.TestCase.run(TestCase.java:118) [junit] at junit.framework.TestSuite.runTest(TestSuite.java:208) [junit] at junit.framework.TestSuite.run(TestSuite.java:203) [junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run (JUnitTestRunner.java:326) [junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeInVM(JUnitTask .java:991) [junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.java :663) [junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.java :637) [junit] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:306) [junit] at org.apache.tools.ant.Task.perform(Task.java:401) [junit] at org.apache.tools.ant.Target.execute(Target.java:338) [junit] at org.apache.tools.ant.Target.performTasks(Target.java:365) [junit] at org.apache.tools.ant.Project.executeTarget(Project.java:1237) [junit] at org.apache.tools.ant.Project.executeTargets(Project.java:1094) [junit] at org.apache.tools.ant.Main.runBuild(Main.java:669) [junit] at org.apache.tools.ant.Main.startAnt(Main.java:220) [junit] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:215) [junit] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:90) [junit] java.lang.UnsatisfiedLinkError: Can't load library: C: \paramconv\dflib.dll [junit] at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1459) [junit] at java.lang.Runtime.load0(Runtime.java:737) [junit] at java.lang.System.load(System.java:811) [junit] at lib.dflib.<clinit>(dflib.java:62) ... [junit] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [junit] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [junit] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl .java:25) [junit] at java.lang.reflect.Method.invoke(Method.java:324) [junit] at junit.framework.TestCase.runTest(TestCase.java:154) [junit] at junit.framework.TestCase.runBare(TestCase.java:127) [junit] at junit.framework.TestResult$1.protect(TestResult.java:106) [junit] at junit.framework.TestResult.runProtected(TestResult.java:124) [junit] at junit.framework.TestResult.run(TestResult.java:109) [junit] at junit.framework.TestCase.run(TestCase.java:118) [junit] at junit.framework.TestSuite.runTest(TestSuite.java:208) [junit] at junit.framework.TestSuite.run(TestSuite.java:203) [junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run (JUnitTestRunner.java:326) [junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeInVM(JUnitTask .java:991) [junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.java :663) [junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.java :637) [junit] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:306) [junit] at org.apache.tools.ant.Task.perform(Task.java:401) [junit] at org.apache.tools.ant.Target.execute(Target.java:338) [junit] at org.apache.tools.ant.Target.performTasks(Target.java:365) [junit] at org.apache.tools.ant.Project.executeTarget(Project.java:1237) [junit] at org.apache.tools.ant.Project.executeTargets(Project.java:1094) [junit] at org.apache.tools.ant.Main.runBuild(Main.java:669) [junit] at org.apache.tools.ant.Main.startAnt(Main.java:220) [junit] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:215) [junit] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:90) [junit] Couldn't find statistics library. The library is named either dflib.dll or dflib.so, [junit] depending on your operating system. Please include the library file into your [junit] system path or the working directory from which you start ...
Any ideas? Also, I would be interested why the setup which worked previously (JDK 1.4.1) does not work anymore now.
Cheers, Volker Augustin
--------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@(protected) For additional commands, e-mail: user-help@(protected)
|
|
 |