Java Dynamic Management Kit 5.1 Tutorial

4.4.1 Open MBean Example 1

In the first open MBean example, we implement an open MBean and manage it through a simple JMX agent application. We develop a sample open MBean that uses some of the open data types and correctly exposes its management interface at runtime through the OpenMBean*Info classes. We then develop a simple JMX agent for exercising the open MBean, which involves:

The examplesDir/current/OpenMBean directory contains the SampleOpenMBean.java file, which is an open MBean, and the OpenAgent.java file which is a simple JMX agent used to interact with the open MBean.

To Run Open MBean Example 1
  1. Compile all files in the examplesDir/current/OpenMBean directory with the javac command.

    For example, on the Solaris platform, type:


    $ cd examplesDir/current/OpenMBean/
    $ javac -classpath classpath *.java
    
  2. Run the agent class that interacts with the open MBean:


    $ java -classpath classpath OpenAgent
    
  3. Press Enter when the application pauses, to step through the example.

    You interact with the agent through the standard input and output in the window where it was launched. The OpenAgent displays information about each management step and waits for your input before continuing.