Monitoring a JMX enabled Tomcat Server
Steps to make Tomcat server JMX enabled
- Open Tomcat server directory
- Open catalina.bat file which will be found under <tomcat dir>/bin/ folder
- In catalina.bat add the following system properties to JAVA_OPTS:
-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=9004
So your JAVA_OPTS line should look something like this:
set JAVA_OPTS=%JAVA_OPTS% -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file="${catalina.base}\conf\logging.properties" -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=9004
Once this is done, start the tomcat using startup.bat in the tomcat bin folder. The server should start with out any errors.
Using MAX to monitor Tomcat using JMX
To monitor JMX enabled tomcat using MAX, follow the steps given below.
- Start Eclipse
- Click on the Menu "Run->profile", profile window opens up
- Select and Right click on the "Managed Resource" configuaration which is there in the left hand side of the Tree view.
- Click on the "New" menu, to create a new Managed Resource configuration.
- Select the check box of "JMX Resource" in the "Monitor" tab
- Click the "Edit Options" button, so "JMX Managed Agent Configuration" windows shows up.
- Set Connection Type to JSR-160
- Set Initial context factory to com.sun.jndi.rmi.registry.RegistryContextFactory
- Set Service URL to service:jmx:rmi:///jndi/rmi://localhost:9004/jmxrmi
- So Managed Agents are created in "Profiling Monitering" view in the left hand side of the eclipse
- Expand Managed Agents and Right click on the "JMX Agent" and click the menu "Open with->Managed Agent Explorer"
Once the resource is opened in the MAX, the user can see its properties and invoke its operations through MAX
(C) Copyright IBM Corporation 2006, 2008. All Rights Reserved.