jConsole – JMX remote access on Tomcat

http://www.mkyong.com/tomcat/jconsole-jmx-remote-access-on-tomcat/

jconsole-example

In this tutorial, we will show you how to use jConsole to remote access a Tomcat instance, for JVM monitoring stuff.

Tools and environment used :

  1. Ubuntu 13 + Tomcat 7 + 192.168.1.142
  2. Windows 8 + jConsole + 192.168.1.200

1. Tomcat + JMX

To connect with jConsole, Tomcat need to enable the JMX options. To solve it, create a {tomcat-folder}\bin\setenv.sh (if not exists), and put the following values :

Bash
-Dcom.sun.management.jmxremote 
-Dcom.sun.management.jmxremote.port={port to access} 
-Dcom.sun.management.jmxremote.authenticate=false 
-Dcom.sun.management.jmxremote.ssl=false
-Djava.rmi.server.hostname={optional, allow what ip to access this Tomcat}

for example,

{tomcat-folder}\bin\setenv.sh
Bash
export JAVA_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9999 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"

Restart Tomcat, now you can connect to this Tomcat via jConsole in port 9999.

2. jConsole Example

2.1 Start jConsole.

Bash
c:\>jconsole

2.2 Select “Remote Process”, type the Tomcat ip and port to connect : 192.169.1.142:9999.

jconsole-tomcat-jmx-example

2.3 Clicks on the button “Insecure connection”. Tomcat detail is shown if connection is successful.

jconsole-tomcat-jmx-memory

References

  1. Monitoring and Managing Tomcat
  2. Oracle : jConsole
  3. Wikipedia : jConsole

One Response so far.

  1. Does your website have a contact page? I’m having a tough time locating it but, I’d like to send you an email. I’ve got some creative ideas for your blog you might be interested in hearing. Either way, great website and I look forward to seeing it grow over time.

LEAVE A COMMENT