EvoSuite / evosuite

EvoSuite - automated generation of JUnit test suites for Java classes
http://www.evosuite.org
GNU Lesser General Public License v3.0
832 stars 341 forks source link

maven java.lang.ClassNotFoundException : org.evosuite.runtime.thread.KillSwitch #325

Open nlenlited opened 3 years ago

nlenlited commented 3 years ago

Context

After filing Issue #324 I tried to create a new project with Evosuite, but again.. its doesnt work.

Steps to Reproduce

Please break down here below all the needed steps to reproduce the issue. Follow the guide stated here; https://www.evosuite.org/documentation/tutorial-part-2/

EvoSuite Arguments

mvn clean -DmemoryInMB=2000 -Dcores=4 evosuite:generate evosuite:export evosuite:prepare test

Current Result

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:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
    at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
    at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
Caused by: java.lang.NoClassDefFoundError: org.evosuite.runtime.thread.KillSwitch
    at java.lang.J9VMInternals.prepareClassImpl(Native Method)
    at java.lang.J9VMInternals.prepare(J9VMInternals.java:304)
    at java.lang.Class.getMethodHelper(Class.java:1247)
    at java.lang.Class.getMethod(Class.java:1191)
    at org.apache.maven.surefire.util.ReflectionUtils.tryGetMethod(ReflectionUtils.java:57)
    at org.apache.maven.surefire.common.junit3.JUnit3TestChecker.isSuiteOnly(JUnit3TestChecker.java:64)
    at org.apache.maven.surefire.common.junit3.JUnit3TestChecker.isValidJUnit3Test(JUnit3TestChecker.java:59)
    at org.apache.maven.surefire.common.junit3.JUnit3TestChecker.accept(JUnit3TestChecker.java:54)
    at org.apache.maven.surefire.common.junit4.JUnit4TestChecker.accept(JUnit4TestChecker.java:51)
    at org.apache.maven.surefire.util.DefaultScanResult.applyFilter(DefaultScanResult.java:97)
    at org.apache.maven.surefire.junit4.JUnit4Provider.scanClassPath(JUnit4Provider.java:194)
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:92)
    ... 9 more
Caused by: java.lang.ClassNotFoundException: org.evosuite.runtime.thread.KillSwitch
    at java.net.URLClassLoader.findClass(URLClassLoader.java:591)
    at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:953)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:898)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:881)
    ... 21 more

Expected result

*The code to actually work.

Additional info

mvn -version output;

[marijn@marijn Tutorial_Maven]$ mvn -version
Apache Maven 3.5.4 (Red Hat 3.5.4-11)
Maven home: /usr/share/maven
Java version: 1.8.0_252, vendor: Eclipse OpenJ9, runtime: /home/marijn/.sdkman/candidates/java/8.0.252.j9-adpt/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.6.11-100.fc30.x86_64", arch: "amd64", family: "unix"
neelofarhassan commented 3 years ago

I am facing the same issue

VoglSebastian commented 3 years ago

It looks like this problem is fixed already fixed in the current master branch. You may consider using the latest version.