Skip navigation.

Developing Manageable Applications with JMX

  Previous Next vertical dots separating previous/next from contents/index/pdf Contents Index View as PDF   Get Adobe Reader

Introduction and Roadmap

As an application developer, you can greatly reduce the cost of operating and maintaining your applications by building in management facilities. The simplest facility is message logging, which reports events within your applications as they occur and writes messages to a file or other repository. Depending on the criticality of your application, the complexity of the production environment, and the types of monitoring systems your organization uses in its operations center, your needs might be better served by building richer management facilities based on Java Management Extensions (JMX). JMX enables a generic management system to monitor your application, raise notifications when the application needs attention, and change the configuration or runtime state of your application to remedy problems.

This document describes using JMX to make your applications manageable.

The following sections describe the contents and organization of this guide—Developing Manageable Applications with JMX.


Document Scope and Audience

This document is a resource for software developers who develop management services for J2EE applications. It also contains information that is useful for business analysts and system architects who are evaluating WebLogic Server® or considering the use of JMX for a particular application.

It is assumed that the reader is familiar with J2EE and general application management concepts.

The topics in this document are relevant during the design and development phases of a software project. This document does not address production phase administration, monitoring, or performance tuning topics. For links to WebLogic Server documentation and resources for these topics, see Related Documentation.

This document emphasizes a hands-on approach to developing a limited but useful set of JMX management services. For information on applying JMX to a broader set of management problems, refer to the JMX specification or other documents listed in Related Documentation.


Guide to this Document


Related Documentation

The Sun Developer Network includes a Web site that provides links to books, white papers, and additional information on JMX:

To view the JMX 1.2 specification, download it from

To view the JMX Remote API 1.0 specification, download it from

You can view the API reference for the* packages from:

For guidelines on developing other types of management services for WebLogic Server applications, see the following documents:

For guidelines on developing and tuning WebLogic Server applications, see Developing Applications with WebLogic Server.


Samples for the JMX Developer

In addition to this document, BEA Systems provides code samples for JMX developers. The examples illustrate management applications in action and provide practical instructions on how to perform key JMX development tasks.

BEA recommends that you run some or all of the JMX examples before developing your own management applications.

Avitek Medical Records Application (MedRec) and Tutorials

MedRec is an end-to-end sample J2EE application shipped with WebLogic Server that simulates an independent, centralized medical record management system. The MedRec application provides a framework for patients, doctors, and administrators to manage patient data using a variety of different clients.

MedRec demonstrates WebLogic Server and J2EE features, and highlights BEA-recommended best practices. MedRec is included in the WebLogic Server distribution, and can be accessed from the Start menu on Windows machines. For Linux and other platforms, you can start MedRec from the WL_HOME/samples/domains/medrec directory, where WL_HOME is the top-level installation directory for WebLogic Platform.

MedRec has instrumented one of its session EJBs for management through JMX. The EJB keeps track of how many times it writes to the database, and exposes this counter as an MBean attribute.


New and Changed JMX Features in This Release

Release 9.0 introduces several important changes to the WebLogic Server JMX implementation:

JMX 1.2 and JMX Remote API 1.0 (JSR-160)

In 9.0, WebLogic Server uses the Java Management Extensions (JMX) 1.2 implementation that is included in JDK 1.5. Prior to this release, WebLogic Server used its own JMX implementation based on the JMX 1.0 specification.

Also in 9.0, remote JMX clients can use the standard JMX remote API 1.0 (JSR-160) to connect to the JMX agents in WebLogic Server. (See Prior to 9.0, the JMX remote API had not been published and remote JMX clients had to use BEA's proprietary APIs to connect to WebLogic Server.

Deprecated MBeanHome and Type-Safe Interfaces

Now that the JMX remote APIs (JSR-160) are published, BEA's proprietary API for remote JMX access,, is no longer needed and is therefore deprecated.

The MBeanHome API also made it possible for BEA to provide a typed API layer over its JMX layer that you could use to interact with WebLogic Server MBeans. Your JMX application classes could import type-safe interfaces for WebLogic Server MBeans, retrieve a reference to the MBeans through the interface, and invoke the MBean methods directly.

As of 9.0, the typed API layer is also deprecated. Instead of using this API-like programming model, all JMX applications should use the standard JMX programming model, in which clients use the interface to discover MBeans, attributes, and attribute types at runtime. In this JMX model, clients interact indirectly with MBeans through the MBeanServerConnection interface.

If any of your classes import the type-safe interfaces (which are under, BEA recommends that you update to using the standard JMX programming model. See Accessing WebLogic Server MBeans with JMX in Developing Custom Management Utilities with JMX. If you do not update your JMX clients, they will use the domain's compatibility MBean server, which is enabled by default.

If you were using the MBeanHome API to automate common configuration tasks, consider using the new WebLogic Scripting Tool (WLST) instead of JMX. WLST is a command-line scripting interface that manages and monitors active or inactive WebLogic Server domains. The WLST scripting environment is based on the Java scripting interpreter Jython. In addition to WebLogic scripting functions, you can use common features of interpreted languages, including local variables, conditional variables, and flow control statements. You can extend the WebLogic scripting language by following the Jython language syntax. See For more information on WLST, see WebLogic Scripting Tool.

Changes to the Model for Distributing Configuration Data in a Domain

WebLogic Server 9.0 enables you to collect modifications to a domain's configuration and distribute them as a group throughout the domain. The 9.0 release also contains APIs that you can use to monitor the distribution of changes.

In 9.0, the Administration Server hosts a set of pending MBeans which are the in-memory representation of all pending changes to a domain's configuration (pending MBean data is backed up in a pending config.xml file). Changes in pending MBeans do not take effect immediately. You must explicitly distribute them in a process that resembles a transaction. If any Managed Server is unable to consume a change, the entire set of changes in a distribution process is rolled back. This transactional process is the only way to change a domain's configuration through JMX. See Managing a Domain's Configuration with JMX in Developing Custom Management Utilities with JMX.

Prior to 9.0, the Administration Server hosted a set of MBeans (administration MBeans) that represented the persisted configuration for all servers and server resources in a domain. To enhance performance, each server instance replicated these MBeans locally and used the replicas, called local configuration MBeans. When a JMX client changed an administration MBean, the Administration Server immediately updated the local configuration MBeans on all server instances in the domain even if the server itself could not integrate the change. In some cases, a local configuration MBean could not be updated without restarting a server instance and the replica and its master administration MBean would contain different values. In addition, JMX clients could directly access local configuration MBeans and change their values, which also resulted in an inconsistent state between replica and master MBean.

Changes to the MBean Data Model

TThe JMX specification does not impose a model for organizing MBeans. However, because the configuration of a WebLogic Server domain is specified in an XML document, WebLogic Server organizes its MBeans into a hierarchical model that reflects the XML document structure.

For example, the root of a domain's configuration document is <domain> and below the root are child elements such as <server> and <cluster>. Each domain maintains a single MBean of type DomainMBean to represent the <domain> root element. Within DomainMBean, JMX attributes provide access to the MBeans that represent child elements such as <server> and <cluster>.

Prior to 9.0:

As of 9.0:

To access the hierarchy, clients can use a set of new service MBeans which are registered in an MBean server under object names that are immutable and well defined. A JMX client supplies this object name to retrieve the service MBean. Then it uses the service MBean's attributes and operations to retrieve the root of a WebLogic Server MBean hierarchy.

New Functionally Aligned MBean Servers

An Administration Server maintains three MBean servers, each of which provides access to different MBean hierarchies. The Edit MBean Server provides access to the domain's editable configuration MBeans; the Domain Runtime MBean Server provides federated access to all runtime MBeans and read-only configuration MBeans in the domain; and the Runtime MBean Server provides access only to the runtime and read-only configuration MBeans on the Administration Server.

Each Managed Server maintains a Runtime MBean Server, which provides access only to its runtime and read-only configuration MBeans.

JMX clients use the standard javax.remote.access (JSR-160) APIs to access and interact with MBeans registered in the MBean servers.

See MBean Servers in Developing Custom Management Utilities with JMX.

Facilities for Registering Custom MBeans

Prior to 9.0, if you wanted to register custom MBeans in an MBean server on a WebLogic Server instance, you could either create your own MBean server or use to register in WebLogic Server's MBean server.

As of 9.0 and JDK 1.5, you can do any of the following from a JMX client that is running in a WebLogic Server JVM:

See Use the Runtime MBean Server in Developing Manageable Applications with JMX.

New Reference Document for WebLogic Server MBeans

All public WebLogic Server MBeans are described in a new document, WebLogic Server MBean Reference. For each MBean, the document describes:


Skip navigation bar  Back to Top Previous Next