Allow remote JMX management for Tomcat
Posted by davidnewcomb on 19 Jan 2009 in Techie
In order to switch on JMX to monitor a Tomcat instance you must firstly switch it on and then tell it what port to listen on. There is also optional support for user names and passwords. JMX helps with remote management and as a consequence will generally let you do some pretty evasive stuff with the internals of your application. So if it is in a production environment passwords might be a good idea!
During Tomcat’s start up sequence it calls the file
TOMCAT_HOME/bin/setenv.bat
(or TOMCAT_HOME/bin/setenv.sh
depending on your environment) which sets up any extra environment variables or Java VM command line options. In some of the Tomcat distributions this file does not exist, so you must create it yourself.
Tomcat’s servlet container is called Catalina so inside TOMCAT_HOME/bin/setenv.bat
we must set our JMX options in the environment variable CATALINA_OPTS
. All the arguments must go on the same line.
set CATALINA_OPTS=-Dcom.sun.management.jmxremote ^ -Dcom.sun.management.jmxremote.port=8181 ^ -Dcom.sun.management.jmxremote.authenticate=false ^ -Dcom.sun.management.jmxremote.ssl=falseThere is extra information on the Sun site related to user name and password authentication, but this was not set by default. The default was to have no authentication. After makeing the changes, restart Tomcat.
1 comment
Comment from: anand [Visitor]

Form is loading...
Thanks a lot for taking the time to write this! wish u good luck in everything from germany :)
cheers, -Anand