JBoss.orgCommunity Documentation

JMX Tools Reference Guide

Version: 1.1.1.GA


1. Introduction
1.1. What is JMX?
1.2. What is JMX Tools?
1.3. Key Features of JMX Tools
1.4. Requirements and Installation
1.4.1. Requirements
1.4.2. Installation
2. JMX Tools Tasks
2.1. Quick Start
2.2. Managing Application
2.3. Tomcat Managing
2.4. Eclipse Equinox Managing
2.5. Managing JBoss AS
2.6. Managing JBoss AS Remotely
2.7. Extension Task
2.7.1. Why we should do that?
2.7.2. Core Extensions
2.7.3. UI Extensions
2.8. Connections Creation Task
2.8.1. Establishing Connection
3. References
3.1. MBean Explorer
3.2. MBean Editor
3.2.1. Notifications Page
4. Summary
4.1. Other relevant resources on the topic

JBoss Tools' JMX project is a fork of eclipse-jmx, a project by Jeff Mesnil. It was forked with permission.

The Java Management Extensions (JMX) technology is a standard part of the Java Platform, Standard Edition (Java SE platform). The JMX technology was added to the platform in the Java 2 Platform, Standard Edition (J2SE) 5.0 release.

The JMX technology provides a simple, standard way of managing resources such as applications, devices, and services. Because the JMX technology is dynamic, you can use it to monitor and manage resources as they are created, installed and implemented. You can also use the JMX technology to monitor and manage the Java Virtual Machine (Java VM).

The JMX specification defines the architecture, design patterns, APIs, and services in the Java programming language for management and monitoring of applications and networks.

Using the JMX technology, a given resource is instrumented by one or more Java objects known as Managed Beans, or MBeans. These MBeans are registered in a core-managed object server, known as an MBean server. The MBean server acts as a management agent and can run on most devices that have been enabled for the Java programming language.

The specifications define JMX agents that you use to manage any resources that have been correctly configured for management. A JMX agent consists of an MBean server, in which MBeans are registered, and a set of services for handling the MBeans. In this way, JMX agents directly control resources and make them available to remote management applications.

The way in which resources are instrumented is completely independent from the management infrastructure. Resources can therefore be rendered manageable regardless of how their management applications are implemented.

The JMX technology defines standard connectors (known as JMX connectors) that enable you to access JMX agents from remote management applications. JMX connectors using different protocols provide the same management interface. Consequently, a management application can manage resources transparently, regardless of the communication protocol used. JMX agents can also be used by systems or applications that are not compliant with the JMX specification, as long as those systems or applications support JMX agents.

Read more about JMX.

This chapter will provide answers to common questions asked by JMX plugin users.

As it has been said earlier in the guide, the JMX technology allows you to monitor and manage Java applications. In this section we will show you how to get connected to a sample Java application and run the sayHello() method remotely from inside of the MBean Explorer.

  1. Save the bundle of JMX API sample classes, jmx_examples.zip, to your working directory.

  2. Unzip the bundle of sample classes.

  3. Compile the example Java classes from within where you unpacked the files directory.

    javac com/example/*.java
  4. Start the Main application, specifying the properties that expose Main for remote management:

             
    java -Dcom.sun.management.jmxremote.port=9999 \
    -Dcom.sun.management.jmxremote.authenticate=false \
    -Dcom.sun.management.jmxremote.ssl=false \
    com.example.Main
     

    If everything was done correctly you will see the

    Waiting for incoming requests...

    message on the screen.

  5. Now launch the Eclipse IDE, in Eclipse open the MBean Explorer. Go to WindowShow ViewOther, select MBean Explorer, and then click the OK button)

  6. Click the New Connection icon in the MBean Explorer menu bar.

  7. In the Create JMX Connection dialog, click the Next button and then click the Advanced tab.

  8. In the JMX URL input field enter the following URL:

    service:jmx:rmi:///jndi/rmi://:9999/jmxrmi

  9. Click the Finish button to establish the connection with the application.

  10. Now expand the connection you have just created, open the com.example package, and click the sayHello() method.

    Once the sayHello() method is selected the MBean Editor is activated.

  11. In the MBean Editor go to the Operation Details section and click the sayHello() button.

    You will get the "Operation invoked successfully" message.


  12. The final step is to make sure the application worked as expected. Open the terminal where you launched the application in step 3. Now you see the "hello, world" message on the screen.

You can manage Equinox through the Equinox monitoring framework.

In this section we will show you how to connect to an Equinox server via JBoss JMX tools. First you need to create a simple servlet and run it on a server. The process of building applications and running them on the server is beyond the scope of this documentation, however this tutorial can be used to give you a better idea of how to build server-based applications with Eclipse Equinox.

Once you have an application running on the server you can connect to it using JBoss JMX tools.

  1. Go to WindowOpen PerspectiveOther and select the JMX perspective.

  2. Switch to the MBean Explorer by selecting WindowShow ViewOther and selecting the MBean Explorer option.

  3. Click the New Connection icon in the MBean Explorer menu bar.

  4. Select the Advanced tab and set the JMX URL to service:jmx:rmi:///jndi/rmi://:8118/jmxserver.


You now have access to the MBeans exposed by Equinox.

This section will outline how to contribute your own Server type with some default behavior.

The MBean Explorer supports several different types of connections. The tooling itself comes only with a default connection type, however other adopters can provide additional connection types that may require additional or non-spec behavior. Connections can be in either the connected state or the disconnected state. Some connection types (such as the default connection type) allow you to control the current state. Other connection types may not.

Similarly, some connection types may be able to be created, and others may not. The default connection type, for example, can be created and deleted at will. The AS Tools connection type, which represents a JBoss server, does not allow you this level of control. A JBoss JMX connection is created when a JBoss server is created in the server's view, and deleted when said server is deleted. The JMX connection for this server is in the connected state only when the server is started.

This document has provided an overview of the functionality included with JXM Tools, as well as walking you through the steps on managing Tomcat, Eclipse Equinox or JBoss Instances and how to create new JMX connections. If you have questions or suggestions concerned both the documentation and tools behavior, you are welcome to JBoss Tools Users forum. Please, use Jira to report bugs and requests on documentation.

You can find the JBoss Developer Studio/JBoss Tools release documentation at http://docs.jboss.org/tools in the corresponding release directory.

The latest documentation builds are available at http://download.jboss.org/jbosstools/nightly-docs.

The JBoss JXM Wiki can be found at http://www.jboss.org/community/wiki/JBossMX

For more information about JMX technology please visit JMX Technology Home Page