Can't stop tomcat normally when I configure jm

2020-07-11 06:10发布

问题:

I added a jmxremote configuraiton in the catalina.bat:

set JAVA_OPTS=-Dcom.sun.management.jmxremote.port=9004 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false

so that I could start jconsole to monitor the tomcat's performance.

But I got a problem that I couldn't stop tomcat normally through $CATALINA_HOME\catalina.bat stop, neither did $CATALINA_HOME\shutdown.bat

Any suggestions?

回答1:

There are 2 things:

  • Please have a look at my blog post, where I summarized how to do it properly (having encountered this in the past...)
  • Make sure that you put the definitions in a place only the start command sees, but not the shutdown. The reason or this is that the jmx remote create a listening socket, making the shutdown to listen to the same port if not configured properly.


回答2:

Are you sure Tomcat started successfully?

Usually you need to add this property before the other jmx properties:

-Dcom.sun.management.jmxremote

http://tomcat.apache.org/tomcat-6.0-doc/monitoring.html#Enabling_JMX_Remote



回答3:

Better to add these parameters to the CATALINA_OPTS in the file setenv.sh or setenv.bat

# JMX OPTIONS
CATALINA_OPT="$CATALINA_OPT "-Dcom.sun.management.jmxremote
CATALINA_OPT="$CATALINA_OPT "-Dcom.sun.management.jmxremote.port=9012
CATALINA_OPT="$CATALINA_OPT "-Dcom.sun.management.jmxremote.local.only=false
CATALINA_OPT="$CATALINA_OPT "-Dcom.sun.management.jmxremote.authenticate=false
CATALINA_OPT="$CATALINA_OPT "-Dcom.sun.management.jmxremote.ssl=false


标签: java tomcat jmx