|
|||
|
Hi,
I'm having some trouble getting a java app to work. Obviously on a VPS the memory setup is a little different to normal, but even the following doesn't work: root@server:/# java -Xms16m -Xmx32m -version Error occurred during initialization of VM Could not reserve enough space for object heap Could not create the Java virtual machine. I'm on a lowly Link1 plan with 64Mb RAM but surely this should still work? Any ideas? Cheers. |
|
|||
|
Hi
I've discussed this issue and written some tips/tricks: http://www.jeveloper.com/blog/2007/0...639380000.html Comment on it so i can get back quicker. We also discussed this on this thread: J2EE Application Servers Regards, Serge
__________________
www.getbriefed.net - Store web notes |
|
|||
|
Hi Serge,
I have actually come across your article already but it doesn't seem to offer a solution to my problem so far as I can see. I ran the script to show free memory and it comes back with 48mb as below: VPS Memory: total: 58 mb used: 10 mb free: 48 mb So, with 48mb free I should be ok with -Xmx32m right? I'm not even trying to run anything yet, just getting the version number would be a start. Even with 'java -Xms12m -Xmx16m -version' I still get the same error as before... |
|
|||
|
Remember that heap space isn't *all* it consumes --- that's just a maximum of heap space (it can and will use additional memory beyond that). You'll be very lucky if you can spin up a java process in 48MB of memory, or on a Link 1 for that matter.
|
|
|||
|
Quote:
Is my english that bad? I wrote a thousand times that -Xmx32m will not force JVM to use JUST 32 megs and no more, of course not. and Xms is the initial heap size, can be set to just 2 megs or even in Kilobytes with "K" Experiment, see what will work for you. Tomcat should be runnable but you won't be able to do much since MySQL even with minimum settings would need 30 megs or more of ram which you don't have.
__________________
www.getbriefed.net - Store web notes |
|
|||
|
I have a link2 plan and have been trying to get Java to run.
I have read all the threads in this forum, jeveloper's blog and numerous other Internet offerings. However despite what exotic jvm parameters i set java will not load and in all situations will simply state. [root@vps bin]# ./java -client Picked up _JAVA_OPTIONS: -Xms4m -Xmx8m Error occurred during initialization of VM Could not reserve enough space for object heap Could not create the Java virtual machine. Btw this is the same result on ubuntu, debian and fedora core. On each attempt to run java the failcnt will increase on privvmpages indicating that the jvm is trying to reserve more memory than i have specified. Yes I know jvm has other memory requirements in addition to those of heap allocation but they should not be this vast. resource held maxheld barrier limit failcnt privvmpages 5864 16613 29720 29720 2 My impression from what I have observed and read from the various sources is that Sun Java is simply not compatible with OpenVZ in a highly memory restricted environment. With openVZ not hiding the underlying system resources and Java not doing what it is told when it sees vast amounts of resources. This kinda sucks in my opinion as its not unreasonable to expect to run a simple Java process with 108mb of memory free. If anyone has had any success in running Sun Java on a link2 plan I would love to hear *exactly* how, and if anyone could assure me that if I upgrade to link3 plan I would be able to get Java running. Or if anyone has any additional thoughts into how to reign in the JVM to doing what it is told. |
|
|||
|
Quote:
I've got the best results from this command: Quote:
|
|
|||
|
Sadly, this isn't a problem with available memory. I have gotten Java to run fine on a VM at home that only has 128MB of RAM. The problem appears to be that OpenVZ by default shows the entire available ram on the hardware to the VM, and Java gets terribly, horribly confused about this. No amount of heap-space and garbage-collection related command line arguments will resolve this issue. I've seen some forum postings about changing the way OpenVZ reports system memory to the virtual machines, but of course that requires root access to the host OS.
|
|
|||
|
I'm not terribly happy about it, but it works.
If you're okay using a 1.4 VM, and don't need some of the security APIs for validating untrusted code, then check out Kaffe (it's www dot kaffe dot org). It's a completely non-Sun version of the Java VM, is included in apt, and will actually run on a Link-2 plan. Now that I'm POSTIVIE this is an issue with the Sun VM and OpenVZ, I'm going to look for other Java implementations that might work, but provide full compatibility with Sun Java. And, now that it's proven that it's a problem with OpenVZ reporting memory in a weird way to the Sun VM, could we please have a VPSLink person look at possible changes to the configuration that will correctly report memory to the guest OSes? -- Kintar |
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|