Java Dynamic Management Kit 5.0 Tutorial

Running the MBean Interceptor Example

The MBean interceptor example in the examples directory shows you two of the main functions of MBean interceptors, forwarding requests to a specific MBean interceptor, and creating virtual MBeans.

The examplesDir/MBeanInterceptor directory contains the following source files:

To Run the MBean Interceptor Example
  1. Compile all files in the examplesDir/MBeanInterceptor directory with the javac command.

    For example, on the Solaris platform, type:

    $ cd examplesDir/MBeanInterceptor/
    $ javac -classpath classpath *.java
  2. Run the example using the classes you have just built, by typing the following command in a terminal window:

    $ java -classpath classpath Agent
  3. Interact with the agent through the standard input and output in the window where it was started.

  4. Load the agent's URL in your web browser:


    You only see the MBeans registered in the DefaultMBeanInterceptor, namely the connector and adaptor MBeans, and the MBeanServerDelegate.

  5. Press Enter to insert the FileMBeanInterceptor and view the files from the local directory as virtual MBeans.

  6. Reload the agent's URL in your web browser to view the new MBeans:

  7. Press Enter to stop the agent.