How to enable remote JMX support on tomcat

July 21, 2011 by
Filed under: java 

We need to monitor tomcat by jconsole and visualvm for check memory/thread/object usage of tomcat when problem occur. So I tried to enable JMX support on tomcat by modify the catalina.sh by some suggest online (in one line, for windows, “export” should be replaced by “set”):

export JAVA_OPTS="-Dcom.sun.management.jmxremote.port=8086
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false"

And connect successfully to tomcat by jconsole on local machine. But failed to connect tomcat on remote machine.

In fact, to enable remote access of JMX, you need to specify the server hostname such as:

export JAVA_OPTS="-Dcom.sun.management.jmxremote.port=8086
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
-Djava.rmi.server.hostname=192.168.32.12"

Note: the hostname could not be 0.0.0.0 to represents any server name. For windows, should use “set” instead of “export”. 

Digg This
Reddit This
Stumble Now!
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

Comments

Comments are closed.