JBoss.orgCommunity Documentation

Chapter 2. JMX Tools Tasks

2.1. Quick Start
2.2. Managing Application
2.3. Tomcat Managing
2.4. Managing a JBoss application server Remotely
2.5. Extension Task
2.5.1. Why you extend the framework
2.5.2. Core Extensions
2.5.3. UI Extensions
2.6. Connections Creation Task
2.6.1. Establishing Connection

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

To start using the JMX Tools it is necessary to open MBean Explorer. Select WindowShow ViewOther, select MBean Explorer and click the OK button.

The MBean Explorer lists all the domains, MBeans, attributes, and operations inside a connection. When you double-click an MBean in the MBean Explorer, it opens a multi-page editor to manage the MBean. The MBean Editor is composed of these pages:

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. You should see output similar to the following:

    [matthew@localhost jmx_examples]$ java -Dcom.sun.management.jmxremote.port=9999 \
    > -Dcom.sun.management.jmxremote.authenticate=false \
    > -Dcom.sun.management.jmxremote.ssl=false \
    > com.example.Main
    Waiting for incoming requests...
    hello, world

It is possible to manage Tomcat using JMX Tools.

Currently, JMX Tooling is able to connect to Tomcat without authentication or with password-based authentication.

Using SSL for authentication is not supported: you need to make sure that the System property com.sun.management.jmxremote.ssl is set to false.

More information to manage Tomcat can be found in the Tomcat management documentation.

Instructions to remotely manage Tomcat are available in Tomcat's monitoring documentation.

The JBoss JMX Tools allow you to easily access and manage a JBoss server remotely. In order to connect to a remote instance of a JBoss server, you need to run the server or make sure the server is launched.

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.