0

Possible Duplicate:
Linux out of memory on VPS

I have a OpenVZ VPS running CentOS 6.3 64 bit and when I try to install JRE 7 64bit using the command:

rpm -Uvh java.rpm

It gives me this error:

Preparing...                ########################################### [100%]
   1:jre                    ########################################### [100%]
Unpacking JAR files...
        rt.jar...
Error: Could not open input file: /usr/java/jre1.7.0_09/lib/rt.pack
        jsse.jar...
Error: Could not open input file: /usr/java/jre1.7.0_09/lib/jsse.pack
        charsets.jar...
Error: Could not open input file: /usr/java/jre1.7.0_09/lib/charsets.pack
        localedata.jar...
Error: Could not open input file: /usr/java/jre1.7.0_09/lib/ext/localedata.pack

I then tried the command:

java -version

And it gives me this error:

Error occurred during initialization of VM
Could not reserve enough space for object heap
Error: Could not create the Java Virtual Machine
Error: A fatal exception has occurred. Program will exit.

Why does this happen if I have more than enough RAM on the VPS to run this (1GB)? Could it be an issue with the host node of the VPS?

Thanks

EDIT 1: Link to beancounter screenshot http://puu.sh/1xwxB

EDIT 2: Link to htop screenshot http://puu.sh/1xwDl

user1710563
  • 141
  • 5
  • 1
    Those "errors" are spurious and can be ignored. The real problem is you don't have as much memory in that VPS as you think you do. Post a copy of your `/proc/user_beancounters`. – Michael Hampton Dec 05 '12 at 21:22
  • I have added a screenshot of the user_beancounters via a link – user1710563 Dec 05 '12 at 21:26
  • Yep, it's the same problem, and the same answer as in the question I flagged this as a duplicate of. – Michael Hampton Dec 05 '12 at 21:27
  • Java's default heap size of 128M pushes you over your guaranteed memory limit. Therefore the memory allocation can fail if the host is overcommitted. You will need to use the `-Xms` and `-Xmx` options to run your JVM, or (even better) switch to anything but OpenVZ. – Michael Hampton Dec 05 '12 at 21:42

1 Answers1

2

Depending on what you want to do I'd suggest stop using OpenVZ and use some real virtualization solution like KVM.

Try running you java app using this command:

java -Xms16m 
Zim3r
  • 1,454
  • 5
  • 24
  • 45