export CATALINA_OPTS="-Dcom.sun.management.jmxremote=true
-Dcom.sun.management.jmxremote.port=<port>
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
-Djava.rmi.server.hostname=<hostname or IP address>"
23. JMX Configuration
This section describes how to configure JMX access in Tomcat for monitoring and managing the server. It’s important to note that authentication is disabled in this example configuration for demonstration purposes only. In a production environment, JMX access should always be secured with authentication and, ideally, SSL encryption. See Password Authentication for more information.
How to configure JMX on Apache Tomcat
Tomcat’s JVM must be executed with these parameters:
-
-Dcom.sun.management.jmxremote=true
-
-Dcom.sun.management.jmxremote.port=<port>
-
-Dcom.sun.management.jmxremote.ssl=false
-
-Dcom.sun.management.jmxremote.authenticate=false
-
-Djava.rmi.server.hostname=<hostname or IP address> (necessary only for remote JMX connections)
With these values, you can use the following URL for connection to the JMX server of your JVM. No user/password is needed.
service:jmx:rmi:///jndi/rmi://<hostname or IP address>:<port>/jmxrmi
.
Configuring JMX on Linux
On UNIX-like OS, set environment variable CATALINA_OPTS, for example:
Add these paramers to file TOMCAT_HOME/bin/setenv.sh
(if it does not exist, you may create it) or TOMCAT_HOME/bin/catalina.sh
Configuring JMX on Windows
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=<port>
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=<hostname or IP address>
Add these parameters to file TOMCAT_HOME/bin/setenv.bat
(if it does not exist, you may create it) or TOMCAT_HOME/bin/catalina.bat
When running Tomcat as a Windows service, add the parameters into the "Java Options" section in the service configuration in the following format:
-Dcom.sun.management.jmxremote=true
-Dcom.sun.management.jmxremote.port=<port>
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
-Djava.rmi.server.hostname=<hostname or IP address>
To enable JMX monitoring of the worker JVM, see Enable Remote JMX Monitoring of Worker JVM |