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.shdepending 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.batwe 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.