Troubles with SureFire plugin: -"The forked VM terminated without saying properly goodbye. VM crash or System.exit called ? " [duplicate]
Asked Answered
J

5

15

While running of unit tests following exception occurs:

org.apache.maven.lifecycle.LifecycleExecutionException: 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 ?
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:600)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)

Any suggestions?

Jairia answered 25/9, 2012 at 15:3 Comment(3)
Hmmm... VM crash or System.exit called ?Saunderson
Could it be a memory problem? I've been having this issue for a while on a Jenkins server and haven't been able to identify the cause.Augend
@Augend - If it was a memory problem, it would likely be showing up in other things, and there's a good chance it would be mentioned in log messages in the system logs; e.g. /var/log/messagesFearnought
F
7

Any suggestions?

The exception's error message probably explains what is going on. One of your unit tests has either

  • called System.exit(), or
  • broken the unit test harness, or
  • done something that has crashed the JVM in which it was running.

We cannot tell you which it was.

(I imagine that the problem is being reported because the maven JVM was expecting the child JVM to write the unit test results to its standard output. What it got back from the child was missing the message (or whatever) that said that the unit tests had finished. It is possible that the root cause might be different from the alternatives suggested, but I doubt it, and it is pointless speculating ...)

There is possibly more information in the logfile for the offending unit test. Check that / them.

Fearnought answered 25/9, 2012 at 15:15 Comment(0)
W
4

I was facing the same issue while running maven goal "package". The issue was resolved when i executed the goal "clean" before executing "package"

Wales answered 30/7, 2013 at 12:38 Comment(0)
R
3

I've had the same issue. Turned out I updated my libs without updating my java version, and I had a little too new servlet.jar. I found following message in the logs, prior to the 'forked VM bla exception':

Caused by: java.lang.UnsupportedClassVersionError: javax/servlet/ServletRequest : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
at java.lang.Class.getMethod0(Class.java:2670)
at java.lang.Class.getMethod(Class.java:1603)
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)

Updating JVM helped.

Richard answered 24/3, 2014 at 23:56 Comment(0)
V
2

I was having this same problem ONLY in jenkins as reported in the accepted answer and lost one hour to realize that the problem was that the jenkins job name had a space in it, this was making something (still don't know what) in the invocation of the surefire plugin go crazy since the job name is the folder inside the jenkins workspace where everything is.

So, to be clear, jenkins has nothing to do with the problem, I only saw it in jenkins because only there I had a space in my path

I hope this helps someone else. This was under surefire 2.14.1 and 2.16.

Viewy answered 29/1, 2014 at 23:12 Comment(1)
Same here, error occurred only in Jenkins suddenly one day. I configured my jenkins job to use "maven 3" not as before "maven 2 legacy". That solved this problem.Chacon
V
0

This may have to do with Administrator rights. I was facing the same issue when running the build mvn clean install from Cygwin.

Now everytime for build I start cygwin as "Run as administrator" and the problem is solved.

Vivianaviviane answered 6/1, 2013 at 19:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.