Connecting JMX to monitor Tomcat

To configure JMX on Tomcat, we need to set the relevant system properties upon JVM startup. We can use the following methods.

We can update the catalina.sh or catalina.bat file in {tomcat-folder}in, adding the following values:

-Dcom.sun.management.jmxremote 
-Dcom.sun.management.jmxremote.port={port to access}
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false

For example, we can add the following values at {tomcat-folder}incatalina.bat:

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

If you want to configure JMX for your Tomcat in Eclipse, you need to do the following:

  1. Go to Window | Show View | Server.
  2. Open the Tomcat Overview configuration window by double-clicking on Tomcat v8.0 Server at localhost.
  3. Under General Information, click on Open launch configuration.
  4. Select the Arguments tab of Edit launch configuration properties.
  5. In VM arguments, add the following properties, and then click OK:
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=8990
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false

After making this change, we need to restart the Tomcat server. After that, we need to test the connection with JConsole. After opening JConsole, we need to provide Remote Process with a hostname and port number, as follows:

In the preceding screenshot, we have provided the hostname as localhost and the port number as 8990. When you click on Connect, you will get a dialog box where you need to click on Insecure connection, and then you will be connected to JConsole.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset