Advertisement

10.15.2008 at 12:09PM PDT, ID: 23817948 | Points: 500
[x]
Attachment Details

Which command line options to java can I use to avoid the following problem

Asked by McVole in Java Programming Language, CGI Scripting, Shell Scripting

Tags:

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
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
#!/bin/bash
 
#make error messages visible in the browser
echo "Content-type: text/plain"         
echo
 
#... stuff omitted here to make the module command available
 
module load java 2>&1
exec java -Xms4m -Xmx16m MyCGI 2>&1
 
Loading Advertisement...
 
[+][-]10.15.2008 at 12:18PM PDT, ID: 22724658

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.15.2008 at 01:29PM PDT, ID: 22725476

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.15.2008 at 01:32PM PDT, ID: 22725528

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.15.2008 at 01:46PM PDT, ID: 22725689

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.15.2008 at 10:32PM PDT, ID: 22728285

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.16.2008 at 09:59AM PDT, ID: 22733215

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.16.2008 at 10:54AM PDT, ID: 22733849

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.16.2008 at 11:29AM PDT, ID: 22734234

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.16.2008 at 03:11PM PDT, ID: 22736234

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.16.2008 at 07:39PM PDT, ID: 22737446

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.16.2008 at 08:40PM PDT, ID: 22737631

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628