// shall I write some keywords here to boost search engine ranking?

Wednesday, November 14, 2007

Enable JMX on Tomcat 5 and above

Since Tomcat 5.0, Tomcat manager webapp was introduced. JMX is not enabled by default on Tomcat 5.0 and above.

However, it is easy to enable it. The only pre-requisite is to run the Tomcat on JDK 1.5 or above.

In order to enable JMX on Tomcat 5.0, simply add this line to your catalina.bat:

set JAVA_OPTS=-Dcom.sun.management.jmxremote.port=7009 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false
Then you may use JConsole that come with JDK 1.5 and above or your favourite JMX client to monitor the Tomcat though port 7009.

Anyway, this will make the JMX open for unauthorised access. Will illustrate the steps to secure the JMX access to Tomcat in coming post.


Anonymous said...

Note that when running in linux at least (not sure about windows), the JAVA_OPTS parameters are used for both startup and shutdown, so I was finding that I was getting port bind errors on shutdown as it was trying to (re) start the JMX listener.

I found that you can use CATALINA_OPTS rather than JAVA_OPTS, and this parameter is only used on startup.

Hope that helps.


Anonymous said...

With JAVA_OPTS work fine, but before stop tomcat you should unset this.
I set JAVA_OPTS variable in environment, start tomcat and unset the variable