Vps – Problem starting Glassfish on a VPS

glassfishjavaubuntu-8.04vps

I am attempting to install Glassfishv3 on my Ubuntu (8.04) VPS using Java 1.6.

I initially tried starting the server using:

asadmin start-domain

and received the following error message:

JVM failed to start: com.sun.enterprise.admin.launcher.GFLauncherException: The server exited prematurely with exit code 1.
Before it died, it produced the following output:

Error occurred during initialization of VM
Could not reserve enough space for object heap

Command start-domain failed.

I attempted to run it again and received a different message:

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

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.

If I run cat /proc/meminfo I get the following (all other values are 0kB):

MemTotal:  1310720 kB 
MemFree:   1150668 kB
LowTotal:  1310720 kB 
LowFree:   1150668 kB

I have checked the contents of glassfish/glassfish/domains/domain1/config/domain.xml and the JVM setting is:

-Xmx512m

Any help on resolving this problem would be appreciated.

Best Answer

The error you've got means that JVM couldn't claim enough memory to start. It is possible that mmap call fails in VPS, though you have lots of free memory reported by system, due to memory overcommit mechanism.

Xmx option to JVM is an upper heap memory limit. You may need to tune it, but it should not prevent glassfish from starting. What you need is Xms option. It is 128Mb by default, try to reduce it first.