Skip navigation.
Downloads | Product Documentation | Support

Developing Manageable Applications with JMX

# Introduction and Roadmap

As an application developer, you can greatly reduce the cost of operating and maintaining your applications by building management facilities into your applications. 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 how to use 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
- Guide to this Document
- Related Documentation
- Samples for the JMX Developer
- New and Changed JMX Features in This Release

# 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 information in this document is 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 related to 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

- This chapter, Introduction and Roadmap, describes the scope and organization of this guide.
- Understanding JMX, gives an overview of JMX and describes how J2EE application developers can use JMX.
- Designing Manageable Applications, recommends design patterns for making J2EE applications manageable through JMX.
- Instrumenting and Registering Custom MBeans, describes how to create your own MBeans (custom MBeans), which enable you to promote your application to the status of a managed object within a larger management system.
- Using the WebLogic Server JMX Timer Service, describes how to configure your JMX client to carry out a task at a specified time or a regular time interval by using WebLogic Server's implementation of the JMX timer service.
- Accessing Custom MBeans, describes options for accessing your MBeans (other than through JMX).

# Related Documentation

The Sun Developer Network includes a Web site that provides links to books, white papers, and additional information on JMX: http://java.sun.com/products/JavaManagement/.

To view the JMX 1.2 specification, download it from http://jcp.org/aboutJava/communityprocess/final/jsr003/index3.html.

To view the JMX Remote API 1.0 specification, download it from http://jcp.org/aboutJava/communityprocess/final/jsr160/index.html.

You can view the API reference for the `javax.management*` packages from: http://java.sun.com/j2se/1.5.0/docs/api/overview-summary.html.

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

- Using WebLogic Logging Services for Application Logging describes WebLogic support for internationalization and localization of log messages and shows you how to use the templates and tools provided with WebLogic Server to create or edit message catalogs that are locale-specific.
- Configuring and Using the WebLogic Diagnostic Framework describes how system administrators can collect application monitoring data that has not been exposed through JMX, logging, or other management facilities.

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 two JMX code samples in the Avitek Medical Records Application (MedRec). 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.

The JMX code in MedRec exemplifies the following management tasks:

- Monitoring an application with JMX.

One of the session EJBs in MedRec is instrumented 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.

- Using JMX to extend a security realm.

A JSP and supporting Java classes in the MedRec application invoke JMX APIs to add a new Administrator user to the MedRec security realm. The JSP provides the interface for collecting the new user information and the supporting classes validate the information and insert the new user into the realm.

For information about the JMX code examples in MedRec, do the following:

1. Start MedRec server.

See Sample Application Examples and Tutorials for BEA WebLogic Server (http://edocs.bea.com/wls/docs91/samples.html).

2. When MedRec server starts, it displays its home page in a Web browser. On the MedRec home page, click the More Samples link.

MedRec displays the WebLogic Server Code Examples viewer.

3. In the Code Examples viewer, in the left pane, do either of the following:

- Expand Avitek Medical Records Sample Application > Features > JMX. Then select the Monitoring an Application with JMX topic.
- Expand Avitek Medical Records Sample Application > Features > Security. Then select the Extending a Realm Using JMX topic.

# New and Changed JMX Features in This Release

This release contains no changes for the WebLogic Server JMX implementation.

## Changes to JMX Features in the WebLogic Server 9.0 Release

WebLogic Server 9.0 introduced several important changes to the WebLogic Server JMX implementation. See Introduction and Roadmap in Developing Manageable Applications with JMX for WebLogic Server 9.0.

##