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

when I use 1.1.1-SNAPSHOT.jar; I got the java.lang.NoClassDefFoundError: #358

Open qfzjava opened 3 years ago

qfzjava commented 3 years ago

I have run the command like this : java -jar \evosuite-1.1.1-SNAPSHOT.jar -projectCP target\classes -class <classname without .class extension, i.e., JVM qualifying name, e.g., org.foo.Bar>

my real command : java -jar D:\work\code\git\evosuite\master\target\evosuite-master-1.1.1-SNAPSHOT.jar -class com.jeeplus.modules.activity.web.ActivityInfoController -projectCP target\classes

I got the error: java.lang.NoClassDefFoundError: javax/validation/ConstraintViolationException at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:348) 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:497) at org.evosuite.testcase.statements.MethodStatement$1.execute(MethodStatement.java:261) at org.evosuite.testcase.statements.AbstractStatement.exceptionHandler(AbstractStatement.java:174) at org.evosuite.testcase.statements.MethodStatement.execute(MethodStatement.java:224) at org.evosuite.testcase.execution.TestRunnable.executeStatements(TestRunnable.java:295) at org.evosuite.testcase.execution.TestRunnable.call(TestRunnable.java:201) at org.evosuite.testcase.execution.TestRunnable.call(TestRunnable.java:54) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.ClassNotFoundException: javax.validation.ConstraintViolationException at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at org.evosuite.instrumentation.InstrumentingClassLoader.loadClass(InstrumentingClassLoader.java:123) ... 16 common frames omitted

can anybody help me? I have tried many times and spent my serveral days!!! thank u very much!!!

apanichella commented 3 years ago

Hi, that error means that the classpath is missing some of the dependencies, and javax.validaton in particular. When using the parameter -projectCP, you should include all dependencies/libraries separated by :.