Surefire, jenkins and NoClassDefFoundException – why not to use white spaces in Jenkins job names

Well, jenkins errors can be mysterious at times..

message : Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.16:test (default-test) 
on project XXX: ExecutionException; nested exception is 
java.util.concurrent.ExecutionException: java.lang.RuntimeException: 
The forked VM terminated without saying properly goodbye. VM crash or System.exit called ?

No, we don’t call System.exit() from our tests :-) Why would surefire be so rude to cause VMs not say properly goodbye?

Maven -e option coming to the rescue. Analyzing entire error and the command line being invoked by surefire here we can see that jenkins attempts to fork in a directory with spaces, which will fail later on in linux when java starts. I haven’t found any immediate solution other than renaming the job to something safe.

Forking command line: /bin/sh -c cd "/etc/web/jenkins/workspace/commit full build/xx/yy/zzz" 
&& /etc/web/jenkins/tools/hudson.model.JDK/jdk1.6.0_45-jaxwsEndorsed/jre/bin/java 
-Xms512m -Xmx1024m -XX:MaxPermSize=256m full build/xxx/yyy/zzzz/../../src/test/resources/java.policy 
-jar '/etc/web/jenkins-home/workspace/commit full build/tesscoll/pu/customer/target/surefire/surefirebooter2206155077895318006.jar' 
Exception in thread "main" java.lang.NoClassDefFoundError: full 
Caused by: java.lang.ClassNotFoundException: 
full at$ 
at Method) 
at java.lang.ClassLoader.loadClass( 
at sun.misc.Launcher$AppClassLoader.loadClass( 
at java.lang.ClassLoader.loadClass( 
Could not find the main class: full. Program will exit.


Leave a Reply

Your email address will not be published. Required fields are marked *