Browse DevX
Sign up for e-mail newsletters from DevX


Monitoring and Managing Tomcat Clusters Using JMX : Page 5

It's easy to monitor and load-balance your Tomcat clusters using JMX MBeans. JMX provides a flexible, modular, and reusable framework for managing your J2EE server components.




Building the Right Environment to Support AI, Machine Learning and Deep Learning

JMX/MBean Monitoring Console
Figure 4. Cluster MBean Details Using the HTML Adapter: The figure shows the sample Web page containing jmx-html output for the Cluster component.
The jmx-html adapter provided by the servletsuite.com group has a simple and easy to navigate interface for displaying MBean attribute details (see Figure 4). You can use this console to view the cluster MBeans details. Web Application Setup
You need to have the JAR files in the classpath to get the sample Web application to compile and run without any problems. Table 4 shows the list of JAR files required to run the Web application and their locations.

Table 4. JMX Web Application Setup—Required JAR Files.

JAR File API Directory
commons-logging-api.jar Common Logging TOMCAT_HOME\bin
jmx.jar Core JMX, MX4J TOMCAT_HOME\bin
servlet-api.jar Servlet API TOMCAT_HOME\common\lib
catalina.jar Core Tomcat classes TOMCAT_HOME\server\lib
commons-digester.jar Commons Digester TOMCAT_HOME\server\lib
catalina-cluster.jar Tomcat Cluster API TOMCAT_HOME \webapps\jmxapp\WEB-INF\lib
commons-collections-3.1.jar Commons Collections TOMCAT_HOME \webapps\jmxapp\WEB-INF\lib
commons-modeler.jar Commons Modeler TOMCAT_HOME \webapps\jmxapp\WEB-INF\lib
log4j-1.2.8.jar Log4J Logging TOMCAT_HOME \webapps\jmxapp\WEB-INF\lib

The Eclipse project file (jmxapp) provided with the downloadable source code has all these JAR files in the project's build path. This article concentrated mainly on accessing the cluster elements from a monitoring standpoint. But you can also use JMX technology to monitor and manage other areas, such as logging, connection pooling, object caching, and application configuration.

Although the sample application currently doesn't provide the ability to update the attributes of a particular MBean component, look for that feature when the Tomcat 5 container becomes more JMX-based as the later versions are released. For example, you might want to do such things as provide centralized statistics from all cluster members so the administrator can decide if more servers need to be added to the cluster, or if a particular server instance can be brought down for maintenance or system upgrades, etc., without impacting the server availability. Finally, although I didn't cover it here, another important piece of JMX is notifications. Notifications allow for the transmission of events—anything from changing an MBean's attribute to the registration of a new MBean in the MBean server. You can use notifications to broadcast any changes in a cluster configuration and perform the required updates in all the cluster members.

Srini Penchikala works as an Information Systems Subject Matter Expert at Flagstar Bank. His IT career spans over nine years with systems architecture, design, and development experience in client/server and Internet applications. He has been involved in designing and developing J2EE applications since 1998. Srini holds a Master's degree (Southern Illinois University, Edwardsville) and a bachelor's degree (Sri Venkateswara University, India) in Engineering. In his free time, Srini loves to research new J2EE technologies and frameworks.
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date