You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Mi...@swissre.com on 2004/03/11 18:24:17 UTC

junit fork and classpath problems

I am using maven rc1, and for doing my tests in order to be able to load
during the test execution some required classes I use the fork option.

in particular something like

maven.junit.fork=true
maven.junit.jvmargs
=-Djava.ext.dirs=D:/AppClient/lib;D:/AppClient/java/jre/lib/ext

I need to preload some classes in the VM I am running my tests with.

If I do so I get the following error:

test:test:
    [taskdef] [DEBUG] Class
org.apache.tools.ant.taskdefs.optional.junit.JUnitTask loaded from parent
loader
    [taskdef] [DEBUG]  +User task: junit
org.apache.tools.ant.taskdefs.optional.junit.JUnitTask
[DEBUG] Found /D:/maven/repository/junit/jars/junit-3.8.1.jar
[DEBUG] Found /D:/maven/lib/ant-1.5.3-1.jar
[DEBUG] Found /D:/maven/lib/ant-optional-1.5.3-1.jar
    [junit] [DEBUG] fileset: Setup scanner in dir D:\somewhere\source with
patternSet{ includes: [**/*Test.java] excludes: [**/*Test*All.java,
**/*AbstractTestCase.java] }
    [junit] [VERBOSE] Implicitly adding D:
\maven\repository\junit\jars\junit-3.8.1.jar;D:
\maven\lib\ant-1.5.3-1.jar;D:\maven\lib\ant-optional-1.5.3-1.jar to
CLASSPATH
    [junit] Running com.swissre.sje.alg.database.SJEALGDatabaseDB2Test
    [junit] [VERBOSE] Executing 'C:
\Srdev\sdk\j2sdk1.4.2_02\jre\bin\java.exe' with arguments:
'-Djava.ext.dirs=D:/AppClient/lib;D:/AppClient/java/jre/lib/ext'
'-Dbasedir=D:\myprojecthome\admin'
'-classpath'
'MYCLASSPATH'
'org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner'
'com.mycompany.MyClassTest'
'filtertrace=true'
'haltOnError=false'
'haltOnFailure=false'
'formatter=org.apache.tools.ant.taskdefs.optional.junit.SummaryJUnitResultFormatter'
'showoutput=false'
'formatter=mMYformatter'
'propsfile=D:\myprojecthome\admin\junit2022631186.properties'

The ' characters around the executable and arguments are
not part of the command.

    [junit] [DEBUG] Execute:Java13CommandLauncher: Executing 'C:
\Srdev\sdk\j2sdk1.4.2_02\jre\bin\java.exe' with arguments:
'-Djava.ext.dirs=D:/AppClient/lib;D:/AppClient/java/jre/lib/ext'
'-Dbasedir=D:\myprojecthome\admin'
'-classpath'
'D:\DATA\IBM\wsappdev51\j2ee\ivp\SR_ALGBase\admin\target\test-classes;D:
\DATA\IBM\wsappdev51\j2ee\ivp\SR_ALGBase\admin\target\classes;D:
\maven\repository\ibm-j2ee\jars\ibm-j2ee-1.3.1.jar;D:
\maven\repository\commons-lang\jars\commons-lang-2.0.jar;D:
\maven\repository\log4j\jars\log4j-1.2.8.jar;D:
\maven\repository\sr_sje\jars\sr_sje_commons-1.0.0.jar;D:
\maven\repository\db2\jars\db2-jdbc-driver-1.0.0.jar;D:
\maven\repository\oracle\jars\oracle-jdbc-driver-1.2.jar;D:
\maven\repository\algbase\jars\LdapBean-1.0.0.jar;D:
\maven\repository\algbase\jars\xa1-1.0.0.jar;D:
\maven\repository\sr_sje\jars\SR_SJE_ALGStubs-1.0.0.jar;D:
\maven\repository\sr_sje\jars\SR_SJE_ALGBaseServices_EJB-0.0.1.jar;D:
\maven\repository\sr_sje\jars\SR_SJE_RequestInterceptor-0.3.0.jar;D:
\maven\repository\sr_sje\jars\SR_SJE_SIC_GenericServiceFactory-1.0.0.jar;D:
\maven\repository\sr_sje\jars\SR_SJE_ALGBase_EJB-0.3.0.jar;D:
\maven\repository\sr_sje\jars\SR_SJE_SIC_LR_Access-0.0.1.jar;D:
\maven\repository\ibm-client\jars\ccf2-5.0.1.jar;D:
\maven\repository\ibm-client\jars\cicseci-5.0.1.jar;D:
\maven\repository\ibm-client\jars\cicsframe-5.0.1.jar;D:
\maven\repository\ibm-client\jars\ctgclient-5.0.1.jar;D:
\maven\repository\sr_sje\jars\SR_SJE_LSLoginTicket_Java-0.3.0.jar;D:
\maven\repository\tarsec\jars\ses-ticket-1.0.0.jar;D:
\maven\repository\sr_sje\jars\SR_SJE_WIP-d.1.0.0.13.jar;D:
\maven\repository\sr_sje_test\jars\ivpct2-1.0.0.jar;D:
\maven\repository\sr_junit\jars\sr_junit-0.3.0.jar;D:
\maven\repository\junitperf\jars\junitperf-1.8.jar;D:
\maven\repository\junit\jars\junit-3.8.1.jar;D:
\maven\lib\ant-1.5.3-1.jar;D:\maven\lib\ant-optional-1.5.3-1.jar'
'org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner'
'com.swissre.sje.alg.database.SJEALGDatabaseDB2Test'
'filtertrace=true'
'haltOnError=false'
'haltOnFailure=false'
'formatter=org.apache.tools.ant.taskdefs.optional.junit.SummaryJUnitResultFormatter'
'showoutput=false'
'formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,D:
\DATA\IBM\wsappdev51\j2ee\ivp\SR_ALGBase\admin\target\test-reports\TEST-com.swissre.sje.alg.database.SJEALGDatabaseDB2Test.xml'
'formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter,D:
\DATA\IBM\wsappdev51\j2ee\ivp\SR_ALGBase\admin\target\test-reports\TEST-com.swissre.sje.alg.database.SJEALGDatabaseDB2Test.txt'
'propsfile=D:
\DATA\IBM\wsappdev51\j2ee\ivp\SR_ALGBase\admin\junit2022631186.properties'

The ' characters around the executable and arguments are
not part of the command.

    [junit] java.lang.NoClassDefFoundError: junit/framework/TestListener
    [junit]       at java.lang.ClassLoader.defineClass0(Native Method)
    [junit]       at
java.lang.ClassLoader.defineClass(ClassLoader.java:537)
    [junit]       at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
    [junit]       at
java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
    [junit]       at
java.net.URLClassLoader.access$100(URLClassLoader.java:55)
    [junit]       at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
    [junit]       at java.security.AccessController.doPrivileged(Native
Method)
    [junit]       at
java.net.URLClassLoader.findClass(URLClassLoader.java:187)
    [junit]       at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
    [junit]       at java.lang.ClassLoader.loadClass(ClassLoader.java:282)
    [junit]       at
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
    [junit]       at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
    [junit]       at
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
    [junit] Exception in thread "main"
    [junit] [ERROR] TEST com.swissre.sje.alg.database.SJEALGDatabaseDB2Test
FAILED


Now I can see from the classpath that the junit package is there.  and Test
Listener is there. I noticed though that Junit is launched via the ant
task, are we sure that the current classpath is used ?

Anyone had this issue ? Or is there something I am doing wrong?

Regards

Michele


This e-mail, including attachments, is intended for the person(s) or
company named and may contain confidential and/or legally privileged
information. Unauthorized disclosure, copying or use of this information
may be unlawful and is prohibited. If you are not the intended recipient,
please delete this message and notify the sender




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org