Failed to start Glassfish after increasing heap size

Alexandre Blanquart picture Alexandre Blanquart · Oct 12, 2011 · Viewed 12.6k times · Source

I want to increase the heap size of my Glassfish. For that, I know that I can go up to 4GB:

java -Xmx4000M -version
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03-384-10M3425)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02-384, mixed mode)

I tried to set in domain.xml file the -Xmx to 2GB:

<jvm-options>-Xmx2000m</jvm-options>

But I am getting the following error:

asadmin> start-domain
Waiting for ... to start .Error starting domain ...
The server exited prematurely with exit code 1.
Before it died, it produced the following output:

Error occurred during initialization of VM
The size of the object heap + VM data exceeds the maximum representable size
launchctl bsexec failed: Inappropriate ioctl for device

Launching the command with -v option gives this:

12 oct. 2011 11:46:34 com.sun.enterprise.admin.launcher.GFLauncherLogger info
INFO: JVM invocation command line:
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java
-XX:+UnlockDiagnosticVMOptions
-XX:MaxPermSize=512m
-XX:NewRatio=2
-XX:+CMSClassUnloadingEnabled
-Xmx2000m
-Xms1000m
...
12 oct. 2011 11:46:35 com.sun.enterprise.admin.launcher.GFLauncherLogger info
INFO: Successfully launched in 45 msec.
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.
Command start-domain failed.

Answer

Alexandre Blanquart picture Alexandre Blanquart · Oct 13, 2011

I found the problem. For some reasons which I do not understand, the "-d32" argument was passed in the command, asking to start in 32 bits mode. When adding

<jvm-options>-d64</jvm-options>

to the domain.xml file, glassfish starts. Please note that this option is not present by default in the file.