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.|
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 SetupRequired JAR Files.
||Core JMX, MX4J
||Core Tomcat classes
||Tomcat Cluster API
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 eventsanything 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.