How to configure JMX on Apache Tomcat

Tomcat's JVM must be executed with these parameters:

  1. -Dcom.sun.management.jmxremote=true

  2. -Dcom.sun.management.jmxremote.port=8686

  3. -Dcom.sun.management.jmxremote.ssl=false

  4. -Dcom.sun.management.jmxremote.authenticate=false

  5. -Djava.rmi.server.hostname=your.server.domain (necessary only for remote JMX connections)

On UNIX like OS set environment variable CATALINA_OPTS i.e. like this:

export CATALINA_OPTS="-Dcom.sun.management.jmxremote=true 
                      -Dcom.sun.management.jmxremote.port=8686 
                      -Dcom.sun.management.jmxremote.ssl=false 
                      -Dcom.sun.management.jmxremote.authenticate=false
                      -Djava.rmi.server.hostname=your.server.domain.com"

File TOMCAT_HOME/bin/setenv.sh (if it does not exist, you may create it) or TOMCAT_HOME/bin/catalina.sh

On Windows each parameter must be set separately:

set CATALINA_OPTS=-Dcom.sun.management.jmxremote=true
set CATALINA_OPTS=%CATALINA_OPTS% -Dcom.sun.management.jmxremote.port=8686
set CATALINA_OPTS=%CATALINA_OPTS% -Dcom.sun.management.jmxremote.authenticate=false
set CATALINA_OPTS=%CATALINA_OPTS% -Dcom.sun.management.jmxremote.ssl=false
set CATALINA_OPTS=%CATALINA_OPTS% -Djava.rmi.server.hostname=your.server.domain

File TOMCAT_HOME/bin/setenv.bat (if it does not exist, you may create it) or TOMCAT_HOME/bin/catalina.bat

With these values, you can use the URL service:jmx:rmi:///jndi/rmi://localhost:8686/jmxrmi for connection to JMX server of JVM. No user/password is needed