JUnit4 - ClassNotFoundException in second execution if tests are in different 
directory.
----------------------------------------------------------------------------------------

                 Key: SUREFIRE-794
                 URL: https://jira.codehaus.org/browse/SUREFIRE-794
             Project: Maven Surefire
          Issue Type: Bug
          Components: Junit 4.x support, Maven Surefire Plugin
            Reporter: Ondrej Zizka


I have a structure where the test sources are in ../src/test/java .
Compiled classes are in default target/test-classes .
When I have two executions with some includes and excludes, the second 
execution throws:

{code}
org.apache.maven.surefire.util.SurefireReflectionException: 
java.lang.reflect.InvocationTargetException; nested exception is 
java.lang.reflect.InvocationTargetException: null
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at 
org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164)
        at 
org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110)
        at 
org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175)
        at 
org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:107)
        at 
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:68)
Caused by: org.apache.maven.surefire.util.NestedRuntimeException: Unable to 
create test class 'org.jboss.as.test.integration.ws.anonymousPojos.web'; nested 
exception is java.lang.ClassNotFoundException: 
org.jboss.as.test.integration.ws.anonymousPojos.web
        at 
org.apache.maven.surefire.util.DefaultDirectoryScanner.loadClass(DefaultDirectoryScanner.java:102)
        at 
org.apache.maven.surefire.util.DefaultDirectoryScanner.locateTestClasses(DefaultDirectoryScanner.java:78)
        at 
org.apache.maven.surefire.junit4.JUnit4Provider.scanClassPath(JUnit4Provider.java:174)
        at 
org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:83)
        ... 9 more
Caused by: java.lang.ClassNotFoundException: 
org.jboss.as.test.integration.ws.anonymousPojos.web
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
        at 
org.apache.maven.surefire.util.DefaultDirectoryScanner.loadClass(DefaultDirectoryScanner.java:98)
        ... 12 more
{code}


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to