This article will reveal some of JMX's architecture. The specification is detailed in JSR-000003, and is available for download. You can also download a reference implementation with source code. After exploring JMX internals, we will use a JavaServer Page (JSP) to interface with JMX using JBoss and Tomcat.
The three JMX layers that are important here are instrumentation, agent, and distributed services.
The instrumentation layer exposes the application as one or more managed beans (MBeans). Each MBean provides access to its state using public methods. An MBean can be any Java object that you modify to support the interfaces and semantics specified in the JMX specification for the type of MBean you create. The MBean types are standard, dynamic, open, and model. A standard MBean provides a static interface. A dynamic MBean exposes its interface to the JMX agent at runtime using metadata. The open MBean is a dynamic MBean that uses predefined Java data types so that dependencies on other classes are reduced, allowing for better runtime discovery and dynamic behavior. The model MBean, as the name implies, is a generic and configurable MBean that is provided with each JMX implementation. You can instantiate and use the model instead of defining your own MBean classes.
The standard MBean is the most common type. As an example, suppose you have a class called Logger that configures application debug messages by specifying a log filename and a verbosity level. You can turn Logger into a standard MBean by creating an interface called LoggerMBean. On this interface, add public setter and getter methods to expose the filename and verbosity attributes. Examples of these
methods for the filename attribute would be setFileName() and getFileName(). The method naming convention for setters and getters is based on the setXXX and getXXX method names like in a JavaBean. Completing the puzzle, the Logger class needs to implement the LoggerMBean interface so that the JMX agent can use introspection to create metadata about the Logger MBean. The MBean is managed from the JMX agent by invoking attribute and other operational methods defined in the interface.
The MBean is the link between the managed resource (your application) and the rest of the JMX framework.