I am endeavoring to run a simple java program from a web script on an apache web server. Attached is the web script, named blah.cgi and it attempts to run MyCGI.class
The script runs fine on on the server when RLimitMem is set to 192M. But I want to run it when I it is only 50M. (The 192M setting was made briefly to see if the concept worked, but the Admin is not willing to leave it there.) How can I convince Sun's JVM to successfully run? Here's the error output in the browser from the script.
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.
I found out that the server is 64 bit so I ran java in the script with the -d64 option, and now I get a different error, as follows.
Error occurred during initialization of VM
Could not reserve enough space for code cache
If I try to control the code cache reservation using e.g. -XX:ReservedCodeCacheSize=
8m then depending upon the limits I assign in that and the other options on the command line, I get either one or the other of the two errors I mentioned.
I also tried the option -Xint to avoid the JIT compiler. This made no difference to behavior under varied options and limits on the java command line.
I also tried these options in combination with the ones above, to no avail.
java -Xmaxjitcodesize8M -Xoss512K -Xms8M -Xmx8M MyCGI
Please note that I tried varying the sizes of the memory limits, and I also ran the script on the command line and ensured that it worked there in each case, before attempting a run in the browser. Even with only a 4M limit on the initial and maximum object heap size and the code size, and a 512K stack, the script ran fine from the command line. It just won't run on the web server unless the memory limit for a CGI script is upped to 192M.
Help! I can't seem to get Java to run in a perfectly reasonable environment. What can I do to make this work, so Java can be used like any other language to write a CGI program without a special variant of apache.
Start Free Trial