This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 143509 - Separate VM Options for start and stop
Summary: Separate VM Options for start and stop
Status: NEW
Alias: None
Product: serverplugins
Classification: Unclassified
Component: Tomcat (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker with 2 votes (vote)
Assignee: Petr Hejl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-08-11 17:43 UTC by stroudcuster
Modified: 2013-05-29 19:45 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description stroudcuster 2008-08-11 17:43:31 UTC
It would be nice to have separate VM Options strings for startup and shutdown of tomcat.  If you include the options
necessary to run a JMX MBean server within tomcat, the presence of these options prevents a shutdown or restart, as the
VM attempts to open another MBean server when stopping the server.
Comment 1 bmaras 2011-10-26 15:54:27 UTC
I encountered the same problem many times before doing the same analysis as you did.

When trying to stop (or restart) Tomcat from Netbeans, nothing ever happened : Tomcat did not stop.

It was because I passed the following options in the "VM Options" field in Netbeans, to enable JMX :
-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9004 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false

In this case, Netbeans passes these parameters in the JAVA_OPTS environment variable.
It works correctly when you want to start Tomcat.
But when you want to stop it, catalina.sh/bat runs another instance of the JVM to tell Tomcat to stop. It uses the same JAVA_OPTS parameters, and thus tries to open a port that is already in use : it fails and Tomcat never stops.

If found a similar issue in tomcat itself :
https://issues.apache.org/bugzilla/show_bug.cgi?id=36976
The fix is that Tomcat now ignores the CATALINA_OPTS when asked to stop

That's why I would propose to display two separate fields in Netbeans configuration : one for JAVA_OPTS and another one for CATALINA_OPTS.
It would enable the user to put the JMX parameters in CATALINA_OPTS, so that stop/restart would work in all cases.
Should I edit the description of this bug for that?

Another workaround is to keep this field empty in Netbeans, and put the parameters in a setenv.sh/bat file in /bin directory of Tomcat :
set JAVA_OPTS=%JAVA_OPTS% -server -Xmx1024m
set CATALINA_OPTS=%CATALINA_OPTS% -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9004 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false
Comment 2 phansson 2013-05-29 19:45:27 UTC
I've struggled with this for months and I'm glad to see someone describe it, finally. (tested on Netbeans 7.3)

The suggestion for enhancement from 'bmaras' seems to be the way to go.