Exception in thread "main" java.lang.NoClassDefFoundError: org/pitest/mutationtest/config/PluginServices at org.pitest.mutationtest.commandline.MutationCoverageReport.main(MutationCoverageReport.java:35)

551 views
Skip to first unread message

Ezequiel Gambaccini

unread,
Jun 10, 2017, 3:52:21 PM6/10/17
to PIT Users
Hello! 

Sorry to bother, but I'm having a problem running pitest through the command line.

This is the command I'm using (Win 10):

java -cp bin;tests\randoop\bin;jars\pitest-1.2.0.jar;jars\pitest-command-line-1.2.0.jar;jars\junit-4.12.jar org.pitest.mutationtest.commandline.MutationCoverageReport --reportDir reports\randoop --targetClasses collections.comparators.FixedOrderComparator --targetTests collections.comparators.FixedOrderComparator_Test --sourceDirs src,tests\randoop\src\

And this is the result:

Exception in thread "main" java.lang.NoClassDefFoundError: org/pitest/mutationtest/config/PluginServices
        at org.pitest.mutationtest.commandline.MutationCoverageReport.main(MutationCoverageReport.java:35)
Caused by: java.lang.ClassNotFoundException: org.pitest.mutationtest.config.PluginServices
        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)
        ... 1 more

I've also tried being more specific, but to no avail:

java -cp bin;tests\randoop\bin;jars\pitest-1.2.0.jar;jars\pitest-command-line-1.2.0.jar;jars\junit-4.12.jar org.pitest.mutationtest.commandline.MutationCoverageReport --reportDir reports\randoop --targetClasses collections.comparators.FixedOrderComparator --targetTests collections.comparators.FixedOrderComparator_Test --sourceDirs src,tests\randoop\src\

I get that it is missing a class, but I don't know which, as I believe the classpath is set correctly, mainly because I'm able to run junit using it.
For example, this works:

java -cp bin;tests\randoop\bin;jars\*  org.junit.runner.JUnitCore collections.comparators.FixedOrderComparator_Test
JUnit version 4.12
..........................................................................................................................................................................................................
....................................................................................................................................................................................................
Time: 0.686

OK (398 tests)

Thanks for your help!

Ezequiel Gambaccini

unread,
Jun 11, 2017, 2:21:45 PM6/11/17
to PIT Users
Finally figured it out after reading how pitest-commandline is compiled.

In order to run pitest-commandline, you have to have the following jars:

pitest-(version_number).jar
pitest-command-line--(version_number).jar
pitest-entry-(version_number).jar


I found that you need pitest-entry after reading the POM.xml of pitest-command-line.
Please add this explicitly to the FAQ as it is not obvious.
Reply all
Reply to author
Forward
0 new messages