Java Management Extensions

Java technology

Java Management Extensions (JMX) is a Java technology that supplies tools for managing and monitoring applications, system objects, devices (such as printers) and service-oriented networks. Those resources are represented by objects called MBeans (for Managed Bean). In the API, classes can be dynamically loaded and instantiated. Managing and monitoring applications can be designed and developed using the Java Dynamic Management Kit.[1]

JSR 003[2] of the Java Community Process defined JMX 1.0, 1.1 and 1.2. JMX 2.0 was being developed under JSR 255, but this JSR was subsequently withdrawn.[3] The JMX Remote API 1.0 for remote management and monitoring is specified by JSR 160.[4] An extension of the JMX Remote API for Web Services was being developed under JSR 262.[5]

Adopted early on by the J2EE community, JMX has been a part of J2SE since version 5.0. "JMX" is a trademark of Oracle Corporation.

## Architecture[edit]

JMX architecture

JMX uses a three-level architecture:

1. The Probe level – also called the Instrumentation level – contains the probes (called MBeans) instrumenting the resources
2. The Agent level, or MBeanServer – the core of JMX. It acts as an intermediary between the MBean and the applications.
3. The Remote Management level enables remote applications to access the MBeanServer through connectors and adaptors. A connector provides full remote access to the MBeanServer API using various communication (RMI, IIOP, JMS, WS-* …), while an adaptor adapts the API to another protocol (SNMP, …) or to Web-based GUI (HTML/HTTP, WML/HTTP, …).

Applications can be generic consoles (such as JConsole[6] and MC4J[7]) or domain-specific (monitoring) applications. External applications can interact with the MBeans through the use of JMX connectors and protocol adapters. Connectors serve to connect an agent with a remote JMX-enabled management application. This form of communication involves a connector in the JMX agent and a connector client in the management application.

Protocol adapters provide a management view of the JMX agent through a given protocol. Management applications that connect to a protocol adapter are usually specific to the given protocol.

## Managed beans[edit]

A managed bean – sometimes simply referred to as an MBean – is a type of JavaBean, created with dependency injection. Managed Beans are particularly used in the Java Management Extensions technology – but with Java EE 6 the specification provides for a more detailed meaning of a managed bean.

The MBean represents a resource running in the Java virtual machine, such as an application or a Java EE technical service (transactional monitor, JDBC driver, etc.). They can be used for collecting statistics on concerns like performance, resources usage, or problems (pull); for getting and setting application configurations or properties (push/pull); and notifying events like faults or state changes (push).

Java EE 6 provides that a managed bean is a bean that is implemented by a Java class, which is called its bean class. A top-level Java class is a managed bean if it is defined to be a managed bean by any other Java EE technology specification (for example, the JavaServer Faces technology specification), or if it meets all of the following conditions:

1. It is not a non-static inner class.
2. It is a concrete class, or is annotated `@Decorator`.
3. It is not annotated with an EJB component-defining annotation or declared as an EJB bean class in `ejb-jar.xml`.

No special declaration, such as an annotation, is required to define a managed bean.

A MBean can notify the MBeanServer of its internal changes (for the attributes) by implementing the `javax.management.NotificationEmitter`. The application interested in the MBean's changes registers a listener (`javax.management.NotificationListener`) to the MBeanServer. Note that JMX does not guarantee that the listeners will receive all notifications.[8]

### Types[edit]

There are two basic types of MBean:

* Standard MBeans implement a business interface containing setters and getters for the attributes and the operations (i.e., methods).
* Dynamic MBeans implement the `javax.management.DynamicMBean` interface that provides a way to list the attributes and operations, and to get and set the attribute values.

Additional types are Open MBeans, Model MBeans and Monitor MBeans. Open MBeans are dynamic MBeans that rely on the basic data types. They are self-explanatory and more user-friendly. Model MBeans are dynamic MBeans that can be configured during runtime. A generic MBean class is also provided for dynamically configuring the resources during program runtime.

A MXBean (Platform MBean) is a special type of MBean that reifies Java virtual machine subsystems such as garbage collection, JIT compilation, memory pools, multi-threading, etc.

A MLet (Management applet) is a utility MBean to load, instantiate and register MBeans in a MBeanServer from an XML description. The format of the XML descriptor is:[9]

<MLET CODE = ''class'' | OBJECT = ''serfile''
ARCHIVE = ''archiveList''
[CODEBASE = ''codebaseURL'']
[NAME = ''objectName'']
[VERSION = ''version'']

[arglist]
</MLET>

## Support[edit]

JMX is supported at various levels by different vendors:

* JMX is supported by Java application servers such as OpenCloud Rhino Application Server [1], JBoss, JOnAS, WebSphere Application Server, WebLogic, SAP NetWeaver Application Server, Oracle Application Server 10g and Sun Java System Application Server.
* JMX is supported by the UnboundID Directory Server, Directory Proxy Server, and Synchronization Server.[10]
* Systems management tools that support the protocol include Empirix OneSight, GroundWork Monitor, Hyperic, HP OpenView, IBM Director, ITRS Geneos, Nimsoft NMS, OpenNMS,[11] Zabbix, Zenoss Core, and Zyrion, SolarWinds, Uptime Infrastructure Monitor, and LogicMonitor.[12]
* JMX is also supported by servlet containers such as Apache Tomcat.[13] & Jetty (web server)
* MX4J [2] is Open Source JMX for Enterprise Computing.
* jManage [3] Archived 2020-08-03 at the Wayback Machine is an open source enterprise-grade JMX Console with Web and command-line interfaces.
* MC4J [4] is an open source visual console for connecting to servers supporting JMX
* snmpAdaptor4j [5] is an open source providing a simple access to MBeans via the SNMP protocol.
* jvmtop is a lightweight open source JMX monitoring tool for the command-line
* Prometheus can ingest JMX data via the JMX exporter[14] which exposes metrics in Prometheus format.
* Jolokia is a j2ee application which exposes JMX over HTTP.

## See also[edit]

* Jini
* Network management
* Simple Network Management Protocol

## References[edit]

1. ^ "Overview of the Java Dynamic Management Kit". docs.oracle.com. Retrieved January 12, 2021.
2. ^ JSR 003: JavaTM Management Extensions (JMXTM) Specification
3. ^ JSR 255: JavaTM Management Extensions (JMXTM) Specification, version 2.0
4. ^ JSR 160: JavaTM Management Extensions (JMX) Remote API
5. ^ JSR 262: Web Services Connector for Java Management Extensions (JMX) Agents
6. ^ Using JConsole to Monitor Applications
7. ^ "The MC4J project creates management software for J2EE application servers and other Java applications". Archived from the original on 2007-03-23. Retrieved 2006-08-27.
8. ^ Java Management Extensions (JMX) – Best Practices
9. ^ "MLet (Java 2 Platform SE 5.0)". Sun Microsystems. Retrieved 2008-06-22.
10. ^ UnboundID Corp. Archived 2012-03-06 at the Wayback Machine
11. ^ "Home".
12. ^ "JMX Data Collection". www.logicmonitor.com. Retrieved 2020-11-20.
13. ^ Apache Tomcat 6.0: Monitoring and Managing Tomcat (Tomcat manual)
14. ^ "JMX Exporter". GitHub. 14 February 2022.

## Further reading[edit]

### Articles[edit]

* "Enabling Component Architectures with JMX" by Marc Fleury and Juha Lindfors
* "Introducing A New Vendor-Neutral J2EE Management API" by Andreas Schaefer
* "Java in the management sphere" by Max Goff 1999
1. Oct 20
2. Nov 20
3. Dec 29
* JMX/JBoss – The microkernel design
* "Manage your JMX-enabled applications with jManage 1.0" by Rakesh Kalra Jan 16, 2006
* "Managing J2EE Systems with JMX and JUnit Archived 2008-05-26 at the Wayback Machine" by Lucas McGregor
* Sun Java Overview of Monitoring and Management
* The Java EE 6 Tutorial: About managed beans

### Books[edit]

* Benjamin G Sullins, Mark B Whipple : JMX in Action: You will also get your first JMX application up and running, Manning Publications Co. 2002, ISBN 1-930110-56-1
* J. Steven Perry: Java Management Extensions, O'Reilly, ISBN 0-596-00245-9
* Jeff Hanson: Connecting JMX Clients and Servers: Understanding the Java Management Extensions, APress L. P., ISBN 1-59059-101-1
* Marc Fleury, Juha Lindfors: JMX: Managing J2EE with Java Management Extensions, Sams Publishing, ISBN 0-672-32288-9

## External links[edit]

* JMX 1.4 (JMX 1.4, part of Java 6)
* JMX at JBoss.com
* JMX on www.oracle.com
* JSR 255 (JMX 2.0)
* JSR 3 (JMX 1.0, 1.1, and 1.2)

* v
* t
* e

Java (software platform)

Platforms|

* Java language
* JVM
* Java ME (Micro)
* Java SE (Standard)
* Jakarta EE (Enterprise)
* Java Card
* Android SDK

Oracle technologies|

* Squawk
* Java Development Kit
* OpenJDK
* Java virtual machine
* JavaFX
* Maxine VM

Platform technologies|

* Applets
* Servlets
* MIDlets
* JSP
* JSF
* Web Start (JNLP)
* Pack200
* Modules

Major third-party technologies|

* Blackdown
* Eclipse
* GNU Classpath
* GWT
* Harmony
* Hibernate
* IcedTea
* Jazelle
* Spring
* Struts
* TopLink
* WildFly

History|

* Java version history
* Java Community Process
* Sun Microsystems
* Free Java implementations

JVM languages|

* BeanShell
* Clojure
* Groovy
* JRuby
* Jython
* Kotlin
* Processing
* Rhino
* Scala
* Oxygene

Community|

| Conferences|

* JavaOne
* Devoxx

|

Organizations|

* Apache Software Foundation
* Eclipse Foundation
* Java Community Process
* Oracle Corporation
* Sun Microsystems, Sun Microsystems Laboratories

People|

* James Gosling
* Arthur van Hoff
* Urs Hölzle
* Patrick Naughton

Category Computer programming portal

* v
* t
* e

Jakarta EE specifications

Web app|

* Servlet
* Pages
* Expression Language
* JSTL
* Faces
* Facelets
* WebSocket

Enterprise app|

* Dependency injection
* Bean Validation
* Enterprise Beans
* JPA
* JMS
* JTA
* Mail
* JCA
* Annotations

Web services|

* JAX-RS
* JAX-WS
* SOAP with Attachments
* Web Services Metadata
* JAXM

Other|

* JAXB
* JAF

Removed|

* JAXR
* JAX-RPC
* Management

Related|

* JAXP
* JDBC
* JMX
* Streaming API for XML

*[v]: View this template
*[t]: Discuss this template
*[e]: Edit this template