Official Content
  • This documentation is valid for:

Tomcat 5.5 uses the built-in remote protocol of J2SE 5.0 (JDK 1.5). So, running Tomcat with JDK 1.5, you can automatically expose your Tomcat server for remote management with JMX.
J2SE 5.0 comes with a JMX client tool called JConsole. The Jconsole application is under the bin directory of JDK 1.5 installation.
Several third-party open source JMX client applications are available, in this paper we will concentrate on MC4J console

MC4J console provides a tree view of MBeans (each of them displays attributes, operations, and notifications). 

How to connect Tomcat 5.5 to MC4J

The steps to be followed are explained here:

1. Specify the following system properties in the management.properties file located in the JAVA_HOME/lib/management directory.
For example, if your Tomcat uses C:\Program Files\Java\jre1.5.0_05 to startup, you should edit the management.properties file located at C:\Program Files\Java\jre1.5.0_05\lib\management.

Uncomment the following lines, and set the appropiate values to the properties:

com.sun.management.jmxremote.port=8999
com.sun.management.jmxremote.ssl=false
com.sun.management.jmxremote.authenticate=false

In production time, in general, you should use authentication to monitor the application. 

2. Edit the Tomcat startup script (catalina.bat or catalina.sh) located in the CATALINA_HOME/bin directory, and modify it as shown below: 

set JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.jmxremote.port=8999

Another way, is to do it by the configuration properties:

img1tomcatmc4j

3. After starting the MC4J console, create a new connection to bind to the JMX server (use the create Server Connection option from the Management menu).

  • In the classPathEntries property you should set the catalina.jar, catalina-cluster.jar, and catalina-optional.jar files (located in %CATALINA_HOME%\server\lib\).
  • In the Initial Context Factory, you should set: com.sun.jndi.rmi.registry.RegistryContextFactory 
  • In the Server URL service property: jmx:rmi:///jndi/rmi://localhost:8999/jmxrmi

You don´t need user credential unless you use authentication to monitor the application.

img2tomcatmc4j

In order to monitor GeneXus applications with JMX, you should configure Enable Management property to "Yes" value. The corresponding entry in client.cfg file is:
ENABLE_MANAGEMENT=1

Troubleshooting

If you cannot connect to a remote JMX location please add the following parameters to the application server

-Djava.rmi.server.hostname=hostname

where hostname can be the name of the host or the IP.


Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant