views:

2236

answers:

7

I have a java junit test that passes when run alone on a development machine. We also have a hudson job which runs all the tests, invoked via ant, on a Mac OS X 10.4 node with Java 1.5. The test was passing in the hudson build until recently but now (with no related code changes) one test fails everytime with the following error:

Error Message

Forked Java VM exited abnormally. Please note the time in the report does not reflect the time until the VM exit.

Stacktrace

junit.framework.AssertionFailedError: Forked Java VM exited abnormally. Please note the time in the report does not reflect the time until the VM exit.

googling shows many others seem to have run into the same problem but there I couldn't find any answer.

+1  A: 

I had this problem and it turns out that the process was actually calling System.exit(). However there was also a bug in Ant where this was showing up sometimes. I think Ant 1.7.1 has the bug fixed. So make sure you are running that version.

Francis Upton
A: 

Is the VM crashing ? Can you find a dump file (called hs_err_pid*.log) ? If that's the case, the dump file will give you clues to why this is crashing out.

Brian Agnew
+1  A: 

I believe I saw this error once when I ended up with multiple versions of junit on my classpath. Might be worth checking out.

Sharebear
A: 

I had the exact same thing a while back. The problem is that System.exit() is being called somewhere. It can be difficult to find though, as the call could come from either your code or one of the libraries you use.

triggerNZ
Whoever publishes a library for general use that calls System.exit() needs to be hunted down and shot.
Michael Borgwardt
A: 

For me, it was an "java.lang.OutOfMemoryError" in the forked VM (junit task with fork="yes") which made this message appear in the main VM.

The OutOfMemory was visible in the ant log (well, is visible since it's still present).

I use ant 1.7.1, so no hope with upgrading ant.

After putting the same VM parameters in "Run>External tools>External tools>JRE" than in Eclipse.ini (-Xms40m -Xmx512m -XX:MaxPermSize=256M) the problem is solved.

I keep fork to "no" to be sure ant use the parameters.

Tristan
Another way to allow the forked junit process to access more memory (detailed here: http://ant.apache.org/manual/Tasks/junit.html) is to use the maxmemory attribute on the junit ant task.
Sean Reilly
A: 

I solved my issue by setting the following environment variable:

Variable: _JAVA_OPTIONS Value: -Xms128m -Xmx512m

ChikoFerrara
A: 

For us, it was actually that we by accident (used a newer version of eclipse) started to use Ant 1.7.x instead of our old ant version which was compatible with our Weblogic 8.1/JDK 1.4.x environment. We fixed this by changing back the Ant Home in Eclipse->Windows->Preferences->Ant->Runtime to our old version of Ant.

Regards Klas

KlasE