Skip to main content

Restful JMX Adaptor

This Project OpenDMK contribution offers an HTTP access to JMX information in a RestFul way. An article published in the JMX NetBeans blog, covers in detail the approach.

RestAdaptor NetBeans project

This contribution is composed of a NetBeans 6 project (directory RestAdaptor). Java sources are located in the src directory. They contain a Jersey Rest resource Java Class (JMXMBeanRestResource) and a Runnable Java Class (JMXRestAdaptor). JMXMBeanRestResource is in charge to connect to the JVM Platform MBeanServer and expose JMX MBean attributes as HTTP Resources. JMXRestAdaptor is in charge to start the JDK 6 HttpServer or Grizzly web container on a dedicated port (provided as an argument) and deploy the JMXMBeanRestResource resource.

The deployment inside JDK 6 HttpServer or Grizzly container is an example of deployment. You can obviously take benefit of the deployability capabilities of Jersey resources and deploy it in Glassfish, Tomcat, etc.


Like OpenDMK code, this contribution is released under and governed by either the GNU General Public License, Version 2 only (GPL) or the Common Development and Distribution License (CDDL).

You can obtain a copy of these licenses from here:

Building and Running the Restful JMX Adaptor using NetBeans

You need first to do a SVN checkout of the Restful Adaptor contribution sources from OpenDMK project. Note: OpenDMK binaries are not required to run the Adaptor. Then:
  • Launch NetBeans 6 if not already launched.
  • Open the RestAdaptor project in NetBeans.
  • NetBeans 6.5 includes Jersey 1.0 as a library, but newer versions and more information may be found at
  • Access the project properties and note or edit the port number in the Run arguments (2020 by default).
  • Run the project.
  • The adaptor will then display the URL on which it is bound, as well as some other information, such as the composition of the URIs and the names of the MBeans.
  • In your browser type the following URL: http://localhost:2020/jmx
  • If your browser is set to accept XML headers by default over HTML headers (as may be the case for Firefox), you will receive the resources without hyperlinks, which is not really the best form for a browser. However, you can still navigate by copying and pasting the URIs until you reach a leaf. The best thing to do is to change your Firefox settings to accept HTML headers by default over XML headers, as follows:
    1. In your browser, type about:config
    2. Go to network.http.accept.default
    3. Prefix the value with text/html.
    You can now navigate from the root to the leaves.
  • If you want to see all accessible URI, go to the following URI: http://localhost:2020/jmx/all
  • Optionally get a subset with "pattern" parameter: http://localhost:2020/jmx/all?pattern=*:type=Mem*

Note: This contribution is a source contribution and is not included in Project OpenDMK bundles. You can only get it from the SVN repository as shown above.


You can send your feedbacks on this contribution to:
Please Confirm