[java] Error: Could not create the Java Virtual Machine


#1

Hi opengamma team,

first of all i wanted to thank you for your remarkable work ,opengamma really look good .and it’s very promising software.
I 'm training to run opengamma OG-Platform-rel-v2.1.0 cloned from github from scratch every thing goes fine until running the example engine with mvn opengamma:server-run -Dconfig=fullstack i got the following as a full stack :

<----------------------------------------------------------------------------------------------------------------------------------------------------->
[INFO] — opengamma-maven-plugin:1.3.1:server-run (default-cli) @ examples-simulated —
[INFO] Running component server: -Dlogback.configurationFile=com/opengamma/util/warn-logback.xml -Xms512m -Xmx1536m -XX:MaxP
rmSize=512M com.opengamma.examples.simulated.ExamplesSimulatedComponentServerDev classpath:/fullstack/fullstack-examplessim
lated-dev.properties
[INFO] Executing tasks

main:
[java] Error: Could not create the Java Virtual Machine.
[java] Error: A fatal exception has occurred. Program will exit.
[java] Error occurred during initialization of VM
[java] Could not reserve enough space for object heap
[java] Java Result: 1
[echo] Server starting…
<------------------------------------------------------------------------------------------------------------------------------------------------------>
this is my configuration:

  • Microsoft Windows XP [version 5.1.2600] 32 Bit
  • maven 3
  • java version “1.7.0_67”

After googling for a day i found that its eventually caused by the last java version 1.7 32bit combination with my OS, in the same spirit i switched java to many java version 1.6 and 1.7.15 already present in my OS, but the problem remain the same.

May i have a hint ,do i change to linux or something else , i’ m pessimist with using windows.
Can you help ?

Thank you in advance for your answers;


#2

OpenGamma is mainly a server-side application, and as such it works best on a 64 bit operating system with 64 bit Java. You appear to have a 32 bit machine, so you need will face some difficulties.

The error means that Java could not find enough memory to run OpenGamma. The config is requesting -Xms512m -Xmx1536m -XX:MaxPermSize=512M. Your best bet is to try reducing the -Xmx1536m value, say to -Xmx1024m.

OpenGamma is Java based so should also run on Linux, however you will still face 32 bit and memory issues.


#3

Hi stephen,

Thank you, now i found a workaround based on youre answer, by just changing the value of -Xmx from run>run Configurations>Examples-Simulated - fullstack server>Arguments to 1024M . now its up and running but as you said ,i sow many exception in the eclipse console, probably due to memory leaks.

Thank you now i will smoothly discover the features provided by opengamma.
PS: the deployment test passed with the same configuration.

cheers


#4

Most of the time you can fix this problem by uninstalling the Java runtime and then reinstalling it all over again.

To do this, go to the control panel and then Programs and Features. If you’re running Windows 8.1 Update 1, just right-click on the Start button and click on Programs and Features. Locate the Java runtime, uninstall it and reboot your PC.

Next, download the latest Java Runtime from java.com, taking care to install the correct version for your PC. You will likely want the 32-bit version as the 64-bit option is specifically for 64-bit browsers. Most browsers are 32-bit on Windows, even on 64-bit editions of the OS.

Sometimes this error can be caused by not having enough system memory allocated to the Java Virtual Machine – or not enough system memory full stop.

You can also try increasing the amount of system memory allocated to the Java virtual machine by setting an environment variable.

To do this, go back to the Control Panel and click on System, then Advanced system settings. Now click the Environment Variables button to bring up a list of all those currently set.


#5

Open the Control Panel
Go to System
Go to Advanced Systems Properties
Then Environment Variables
In System Variables, click Add
New Variable Name: _JAVA_OPTIONS
New Variable Value: -Xmx512M
Click OK

That’s it, your Java program should now be able to execute properly.
For those interested, Java -Xmx/s is the configuration parameter that control the amount of memory Java uses.

Xmx sets the maximum heap memory size
Xms sets the minimum heap memory size

More about…Java Virtual Machine

Ling