Question

I have written a Java Spring-WS-Application server and am trying to deploy it from the command line using maven. However, when attempting to execute a "mvn clean package" it tells me that it couldn't create the Java virtual machine due to lack of heap space. My computer only has 4GB of RAM and is sadly running 32-bit windows. The deployment is successful so long as I include a -DskipTests.

This project has dependencies on other projects my team has written, and I can deploy them using "mvn clean install" with no problem. I can also deploy other servers without issue, so I don't think my java version is corrupted. Additionally, other members of my development team have been able to successfully deploy this server on their machines.

I have also gone through and commented out all @Test annotations to attempt and find the faulting test, but it still gives me this error when there are no tests to run.

Any thoughts as to why this may be happening?

Java version:

java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
Java HotSpot(TM) Client VM (build 23.21-b01, mixed mode, sharing)

Result from "mvn clean package:"

   C:\workspace\My-Project>mvn clean package
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building My Project Spring-WS Application 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ my-project ---
[INFO] Deleting C:\workspace\My-Project\target
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ my-project ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\workspace\My-Project\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.0:compile (default-compile) @ my-project ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 49 source files to C:\workspace\My-Project\target\classes
[WARNING] Note: C:\workspace\My-Project\src\main\java\my\package\of\doom\impl\classImpl.java uses or overrides a 
deprecated API.
[WARNING] Note: Recompile with -Xlint:deprecation for details.
[INFO]
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ my-project ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.0:testCompile (default-testCompile) @ my-project ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 25 source files to C:\workspace\My-Project\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.14:test (default-test) @ my-project ---
[INFO] Surefire report directory: C:\workspace\My-Project\target\surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Error occurred during initialization of VM
Could not create the Java virtual machine.
Could not reserve enough space for object heap

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.783s
[INFO] Finished at: Thu Jun 13 09:01:15 EDT 2013
[INFO] Final Memory: 14M/54M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.14:test (default-test) on project my-pro
ject: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.14:test failed: The fo
rked VM terminated without saying properly goodbye. VM crash or System.exit called ?
[ERROR] Command wascmd.exe /X /C "C:\Oracle2\Middleware\jdk160_24\jre\bin\java -Xms512m -Xmx1024m -XX:MaxPermSize=512m -
jar C:\workspace\My-Project\target\surefire\surefirebooter4008500116671254841.jar C:\workspace\My-Project\target\surefir
e\surefire8598565507069545685tmp C:\workspace\My-Project\target\surefire\surefire_07977292658698847040tmp"
[ERROR] ->     [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR]     [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

Eclipse.ini:

-vm
C:/Oracle2/Middleware/jdk160_24/bin/javaw
-startup
plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.100.v20110502
-showsplash
org.eclipse.platform
--launcher.defaultAction
openFile
-vmargs
-Xms512m
-Xmx1024m
-XX:MaxPermSize=512m
-Dsun.lang.ClassLoader.allowArraySyntax=true
Was it helpful?

Solution

Look closely at the error message. It says there is not enough memory for the test JVM's heap. Try releasing some memory (shutdown Eclipse) and/or run the tests with a lower heap / perm gen size (surefire setting).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top