Home > Store > Programming > Java

Java™ and JMX: Building Manageable Systems

Register your product to gain access to bonus material or receive a coupon.

Java™ and JMX: Building Manageable Systems

Book

  • Your Price: $43.99
  • List Price: $54.99
  • Usually ships in 24 hours.

Description

  • Copyright 2003
  • Dimensions: 7-3/8x9-1/4
  • Pages: 592
  • Edition: 1st
  • Book
  • ISBN-10: 0-672-32408-3
  • ISBN-13: 978-0-672-32408-6

Java is now used with increasing frequency to develop mission-critical applications. Using Java Management Extensions (JMX) is the key to managing those applications. As JMX is increasingly accepted into the fields of embedded systems, enterprise systems, and telephony, it is clear that all Java developers will encounter JMX before long.

Java™ and JMX: Building Manageable Systems is the definitive guide to JMX, combining an introduction to the technology with extensive coverage that will make this book a favorite reference. Much more than just an explanation of the JMX specifications, this book can drastically reduce a reader's JMX learning curve by explaining how to develop management requirements and apply JMX to them. The book's coverage includes:

  • A management primer for Java programmers and architects
  • A historical perspective on the evolution of JMX and its relation to other management standards, including SNMP, CIM/WBEM, TMN, and CMIP
  • Development of JMX Manageable Resources with Standard and Dynamic MBeans
  • Development with Model MBeans as customizable generic instrumentation using both the JMX APIs and XML files
  • MBeanServer, including the MBean registry and object naming scheme, the generic MBean interface, and the query mechanism
  • JMX Monitors and Notifications
  • MBeanServer Services including the timer, relationship, and dynamic loading, along with custom services for XML services, HTTP adapters, RMI connectors, and security exposures and permissions
  • JMX best practices, including deployment patterns, instrumentation patterns, federation patterns, and best practices
  • JMX integration into J2EE and the JSR077 management models in J2EE 1.4
  • Using JMX to manage Web services from the perspective of service providers, registry providers, and users

Written with an unparalleled degree of in-the-trenches familiarity and full of practical examples and working sample code, Java™ and JMX is a must-have introduction, technological guide, and reference for Java architects and developers.



0672324083B12052002

Downloads

Source Code

Source Code

Source code

Sample Content

Online Sample Chapter

Introduction to JMX

Downloadable Sample Chapter

Click below for Sample Chapter(s) related to this title:
Sample Chapter 2

Table of Contents



Preface.

Part I. JMX Introduction.

1. Management Concepts.

Progress of Management.

Why Invest in Management?

The Natural Evolution of Management.

Management Architectures.

Managed Resource.

Agent.

Subagent.

Midlevel Manager.

Management System.

Management Technologies.

Proprietary Technologies.

Standard Technologies.

Managing the Lifecycle.

Management Disciplines.

Distribute.

Install.

Configure.

Monitor.

Control.

Managed Resource Responsibilities.

Management Data.

Management Operations.

Management Instrumentation.

Management Patterns.

Event Generator.

Noninterruptible.

Queryable.

Operational.

Management Applications.

Distribution Applications.

Inventory Applications.

Topology Applications.

Configuration Applications.

Operations Applications.

Event and Automation Applications.

Monitoring and Performance Applications.

Summary.

General References.

Notes.

2. Introduction to JMX.

Why We Need JMX.

Choosing a Management Technology.

Dealing with Diversity.

Being Managed by Multiple Management Applications.

Supporting Application-Specific Management Systems.

Which Applications Should Be Manageable?

Complex Applications.

High-Volume Applications.

Mission-Critical Applications.

Corporate Applications.

Applications with Expectant Customers.

The Goals of JMX.

Simple API.

Dynamic Management.

Isolation.

Generic Management.

History.

JMAPI.

JDMK.

JMX.

The Specification and Compliance.

The Reference Implementation.

JMX Overview.

JMX-Managed Resources.

Mbeans.

JMX Agents.

JMX Adapters.

Adapter Tools.

Quick Tour of JMX.

todd, the Time of Day Daemon.

todd Management.

toddÕs Mbeans.

Incorporating an MbeanServer.

Monitoring todd.

Browser Control.

Summary.

Notes.

Part II. JMX Details.

3. All about Mbeans.

MBean Fundamentals.

The Management Interface.

The Introspection Algorithm.

MBean Construction.

Standard Mbeans.

Dynamic Mbeans.

Active Mbeans.

Open Mbeans.

Design Guidelines.

Summary.

4. Model Mbeans.

Introduction.

The Simplest Model MBean Example.

The ModelMBean Interface.

DynamicMBean.

PersistentMBean.

ModelMBeanNotificationBroadcaster.

Managed Resources.

ModelMBeanInfo.

Descriptors.

Model MBean Descriptors.

Attribute Descriptors.

Constructor Descriptors.

Operation Descriptors.

Notification Descriptors.

Behavior of the Model Mbean.

Caching.

Values and Validation.

Delegation.

Persistence.

Logging.

Miscellaneous Descriptors.

XML Service: Priming ModelMBeanInfo from XML Files.

Using Model Mbeans.

Creating Static Model Mbeans.

Creating Dynamic Model Mbeans.

Adding Custom Descriptors.

Overriding the RequiredModelMBean Class.

Common Mistakes with Model Mbeans.

Caveats.

Transactionality.

Remoteness.

Summary.

XML File Example.

Notes.

5. The MbeanServer.

The MBeanServerFactory Class.

Object Naming.

Object Name Domains.

Object Name Key Properties.

The ObjectName Class.

The ObjectInstance Class.

The MBeanServer Interface.

MBean Lifecycle Methods.

MBean Access Methods.

MBeanServer Methods.

The MBeanServerDelegate Mbean.

Finding Mbeans.

Query Expressions.

Query Scope and Pattern Matching.

MBeanServer Query Methods.

Notifications.

Summary.

6. Monitors and Monitoring.

The JMX Monitor Service.

The Monitoring Package Structure.

The Monitor Mbean.

MonitorNotification.

Concrete Monitors.

Monitoring ApacheÕs Status.

Canonical Usage Pattern.

StringMonitor.

CounterMonitor.

GaugeMonitor.

Summary.

7. JMX Agent Services.

Timer Service.

The Notification Queue.

Timer Notifications.

The Timer Class.

Dynamic MBean Loading Service.

The MLET Tag.

MLet Examples.

The MLet API.

Relation Service.

A Simple Example: The SessionPool Relation.

The RelationService Class.

JMX Connectors.

Connector Mbean.

Connector Client Proxy.

Summary.

Securing JMX.

JMX Security Exposures.

Permission-Based Security Fundamentals.

Permissions.

SecurityManager.

Policy.

JMX Permissions.

MbeanServerPermission.

MbeanTrustPermission.

MbeanPermission.

Using JMX Security.

A Simple Process Management Application (SPMA).

Running with Security Enabled.

Policy Configuration.

Summary.

9. Designing with JMX.

MBeanServer Deployment Patterns.

Daemon.

Component.

Driver.

Instrumentation Patterns.

Applications as Mbeans.

MBeans on Behalf of Applications.

Publish-Only Mbeans.

Facades for Distributed Applications.

MBean Registration and Lifecycle.

Registration by Application.

Registration by Third Party.

Registration by Management Adapter.

Registration by MBeanServer Bootstrap.

Best Practices.

MBean Granularity.

Application Self-Management.

Resource Schema.

Notifications and Logging.

Federation Options.

Summary.

Part III. Application of JMX.

10. J2EE and JMX.

Java 2 Enterprise Edition.

J2EE Management.

Management Tool Access: The MEJB.

J2EE Management Models.

The Base Managed-Object Model.

The Management Domain Model.

The J2EE Application Server Model.

J2EE Application Component Models.

J2EE Server Runtime Components.

Standard Management Functions.

State Management.

Event Generation.

Performance Monitoring.

Stats Interface Details.

Application-Specific Extensions.

Areas Missing from J2EE Management.

The Vision.

Sample JSR 77 Code.

Summary.

Notes.

11. Web Services and JMX.

Web Services Overview.

Service-Oriented Architecture.

Web Service Stack.

Web Service Registry Management.

Registry Owner.

Registry User.

Web Service Execution Environment Management.

Execution Environment Owner.

Execution Environment User.

Web Service Management.

Web Service Owner.

Web Service User.

Summary.

Code Listings.

UDDIRegistryClientManagerMBean Implementation.

WebServiceRuntimeManagerMBean Implementation.

WebServiceManagerMBean Implementation.

StockQuote Service WSDL Document.

Notes.

Appendix. JMX in Products.

JMX Agent Implementations.

JMX 1.0 Reference Implementation from Sun Microsystems.

JDMK 4.2 from Sun Microsystems.

TMX4J 1.0 from Tivoli Systems.

AdventNet Agent Toolkit Java/JMX Edition.

AdventNet ManageEngine.

MX4J.

JMX Managers.

Tivoli Web Component Manager.

Dirig Software.

AdventNet Middleware Manager.

AdventNet Web NMS.

Vigor Soft hawkEye.

JMX-Enabled Products.

IBM WebSphere 5.0.

IBM Web Services Tool Kit 3.1.

IBM WebSphere Voice Server.

IBM WebSphere Business Components Composer.

BEA Systems WebLogic Server 7.0.

IONA iPortal.

IONA Technologies PLC: Orbix E2A XML Bus Edition 5.3.

Hewlett-Packard OpenView.

Hewlett-Packard Core Services Framework.

Jboss.

Sonic Software SonicXQ.

Pramati Server from Pramati Technologies.

Sybase EAServer 4.0.

Sun Microsystems: Sun ONE Application Server.

Sun Microsystems: Sun ONE Portal Server.

Compiere Open Source ERP & CRM.

Notes.

Index. 0672324083T05022003

Preface

Welcome! You have just opened your key to the secret art of management. This book is your comprehensive guide to the development of manageable application software using the Java Management Extensions (JMX). Now that Java has made the leap from cool to critical, every developer who has deployed a mission critical application knows it is not enough just to write great code; to be truly useful, critical applications must be manageable as well. With the publishing of the JMX specification and the availability of multiple JMX implementations, Java programmers have a standard mechanism with which to instrument and manage their software products. This book will provide you with the information necessary to leverage JMX to create a new generation of better instrumented, more manageable, and therefore more reliable mission critical Java applications.

At the moment the two biggest growth areas for Java are enterprise and embedded systems. Tens of thousands of IT developers are now or soon will be using J2EE technologies to create mission-critical business systems. The major J2EE vendors, including IBM WebSphere and BEA WebLogic application servers, are using JMX to provide their own management as well as enable yours. The J2EE 1.4 standard is being extended to include management interfaces using JMX as defined by JSR077. At the other end of the spectrum, thousands more developers will be using Java to create embedded applications from set top boxes to remote pumping station monitors. It is essential that these applications, which run unattended on "invisible computers" for the most part, be as self-monitoring and self-managing as possible. JMX provides a substrate upon which to construct such self-monitoring/managing applications, and a copy of this book will substantially reduce your JMX learning curve. JMX is also being accepted by the telephony industry as a management infrastructure for Java API for Intelligent networks (JAIN). As these specifications for the use of Java in telephony service environments emerge, whole new industries will need to become familiar with JMX. The probability that you will encounter JMX in one form or another, as part of your own designs or as the instrumentation mechanism for components of your infrastructure, is very high. This book will give you the foundation and technical details you need to make effective use of JMX wherever you find it.

While it is well known that JMX is continuing to evolve, its basic architecture and interfaces will remain consistent. There is more to using JMX then understanding the architecture and interfaces, you also need to understand how to connect it to management systems, the role it plays in the management industry, appropriate use of the technology, as well as management design patterns. You need to understand how to create a manageable system. This book has been written in a comprehensive manner by experts in that space. This book also gives you an in depth understanding of the application of JMX in hot technologies: J2EE and Web services. You will find this book to be useful long after new versions of JMX become available, because the concepts introduced in this book are classic applications of management concepts and technologies to the Java family. This book will do more than help you write MBeans; it will help guide you in building manageable systems.

This Book's Intended Audience

Our primary goal in writing this book is to explain Java based management, manageability, i.e., enabling resources to be managed, and JMX in detail, and make it easy to understand.

Architects and developers involved in the design and implementation of mission-critical Java applications are the primary audience for this book. They understand that their biggest challenges come well after the first successful installation of a new piece of software when their client's business becomes critically dependent on that software. Then it is essential that administrators be able to monitor and manage the application day and night in order to keep the business in business. Until recently each Java-based product had to develop its own ad hoc management solution. That changed with the publishing of the "Java Management Extensions Instrumentation and Agent Specification, v1.0."

This book has been written especially for Java developers who find themselves in a situation where they must enable their application to be managed by an "outside" management system.

Other Java developers and architects who will find this book useful include:

  • Those who are to help create a new administrative or management system for their Java application
  • Those who need to integrate their application into an existing JMX-based administrative or management system
  • Those who want to develop some management functions to interact with an application that supports JMX
  • Curious folks who just like to know what all the Java acronyms stand for

This book assumes that you do not have a background in systems or applications management, and provides a comprehensive overview of the history of the management industry and the forces that combined to make JMX the ubiquitous management technology for Java resources across the Java community. Java resources deployed in the micro, standard, and enterprise editions of the JDK can all use JMX.

The authors have extensive first hand experience with JMX from nearly every angle. Heather was an original member of the JMX expert group and personally contributed the specification, Reference Implementation (RI), and Test Compatibility Kit (TCK) for ModelMBeans. She is now involved in Web services and applying management to this emerging space. Ward is the lead architect for Tivoli's implementation of JMX, TMX4J, as well as Tivoli's Web Component Manager product, which uses JMX to manage resources. Leigh was a member of JSR077 J2EE Management and the architect for WebSphere's JMX support and JSR077 support. This book represents our experience with JMX from all these projects; we bring you a unique insider perspective on the intent, implementation, application, and even pitfalls of JMX. All of this JMX experience is in the context of our extensive experience in all aspects of management systems and middleware.

This book will be valuable for developers of applications that should be managed, developers of middleware, and developers of management systems. We hope that you will find this book useful not only as an introduction to JMX, but also as a frequent desktop reference as you connect your application to an existing management system or start to develop your own management application.

What You Need to Know Prior to Reading This Book

This book assumes that you are familiar with developing applications using Java. We do not assume that you have experience with management systems. As such, the first chapter introduces management concepts, disciplines, and architectures. If you are familiar with management systems, then you may skip this chapter and start with Chapter 2, "Introduction to JMX."

Chapter 10, "J2EE and JMX," explains JSR077 "J2EE Management" in depth, as well as how it relates to JMX. This chapter assumes that you have a high-level understanding of the components of the J2EE specification and its realization in J2EE application servers.

Chapter 11, "Web services and JMX," explains how JMX can be used to develop manageable Web service applications. It will be helpful to have a general understanding of what a Web services is, and familiarity with common Web service architectures.

What You Will Learn from Reading This Book

This book will provide you with the necessary information, insight, and examples to use JMX to build manageable mission-critical applications or provide a standard management interface to homegrown and third-party management applications.

It is sometimes as important to understand the context of Java technologies as it is to understand the technology itself. This is the case with JMX. Therefore, this book gives you almost two chapters detailing the history of management systems, management architectures, applications, and technologies. In these chapters we also explain the forces that combined to make JMX so important for the Java community. This book gives you the background you need to understand and enter conversations in the management industry.

Specifically, you will learn to develop standard and dynamic MBeans to represent JMX manageable resources in their applications. You will understand how and when to leverage the Model MBean to rapidly develop extensible instrumentation and how to represent interdependent management components using the JMX Relation Service. Because instrumentation inevitably requires monitoring, this book discusses the use of JMX's various monitors and its notification model in detail. In addition, this book provides working example code to illustrate the application of JMX technology in a number of settings, including J2EE and Web services.

Software Needed to Complete the Examples

At a minimum, you will need to have a J2SE JDK and a JMX implementation installed on your computer to compile and run the samples shown throughout this book. These samples have been tested with the TMX4J and MX4J implementations. TMX4J is 100% Java code and should run on any platform, but it has been tested on a Windows operating system. The TMX4J can be downloaded for free from the IBM AlphaWorks Web site at http://www.alphaworks.ibm.com.

The examples in chapter 10 demonstrate solutions based on J2EE application server products such as WebSphere Application Server. A list of J2EE servers that support this is listed in appendix A. Complete product information for WebSphere Application Server may be found on the Web at http://www.ibm.com/products/websphere.

In order to run the examples in Chapter 11, you will need a Web services runtime including a web server, servlet engine, soap engine, and JMX implementation. The samples in this chapter were tested with the IBM Web Services Toolkit which is available for free from the IBM AlphaWorks web site at http://www.alphaworks.ibm.com.

How This Book Is Organized

We have arranged the content of this book into three broad sections. The first section introduces you to management and JMX. The next section gives you a detailed and comprehensive coverage of the JMX architecture, APIs, programming techniques, and pitfalls. We even supply you an entire chapter on design and implementation suggestions, along with our favorite pitfalls. The final section lays out the application of JMX in two fast-growing fields: J2EE and Web services. We recognize that each reader will be interested in different portions of the book and not everyone will need to read every chapter. For those already familiar with management systems, you may skip Chapter 1, "Management Concepts," which introduces management concepts, disciplines, and architectures. We encourage everyone to at least read Chapter 2, "Introduction to JMX." You should feel free to read those chapters that most interest you or are most immediate to your needs. If you have a general understanding of JMX, then the rest of the chapters of the book can stand alone, so it is not necessary to read the book straight through.

The following is a quick summary of the contents of each of the three sections of the book and their chapters:

  • Part I: JMX Introduction The first part of the book, Chapters 1 and 2, introduces you to the management world and JMX. JMX is a management technology, and using it effectively requires some fundamental understanding of the aspects of management and JMX's role in each. Chapter 1, "Management Concepts," describes the basic concepts and vocabulary of system and applications management. It starts with highlighting the history of management technologies. This chapter explains management disciplines, applications, architectures, and information. Chapter 2, "Introduction to JMX," describes why and how JMX came about, and then introduces each of the fundamental elements of JMX, MBeans, MBeanServer, and Notifications. We give you a hands-on tour of JMX, using a simple server and then instrumenting it for management using JMX to illustrate each of the elements. If you are new to management and JMX, we recommend that you read the chapters in this part first to provide common background material and terminology for the remainder of the book.
  • Part II: JMX Details Part II is the meat of this book. This section gives you the comprehensive coverage of JMX along with practical examples and advice, including how to relate Security to JMX. The Management Beans that you will need be able to implement are introduced with extensive examples and advice in Chapter 3, "Mbeans," and Chapter 4, "ModelMbeans." Chapter 5, "The MbeanServer," describes the MBeanServer that is central to JMX's agent architecture and key to its flexibility. This chapter describes the interfaces and services the MBeanServer provides: the MBean registry and object naming scheme, the generic MBean interface, the query mechanism, and the notification support. Chapter 6, "Monitoring," and Chapter 7, "The Mbean Services," help you understand the standard services JMX provides and how to use them. They also discuss the process of creating custom monitor MBeans and custom JMX service MBeans. To illustrate, they explain the RMI Connector Server and HTTP Protocol Adaptor examples from the TMX4J package. Chapter 8, "Security," covers a crucial topic that the JMX specification is silent on. This chapter describes the security exposures presented by the management domain and offers a transparent security layer based on the one designed for TMX4J. Finally, this section closes with pure gold of Chapter 9, "Designing with JMX." In this chapter, all the authors shared their experiences with JMX and how they can be leveraged in real systems. This includes discussions on deployment models, instrumentation patterns, best practices, and pitfalls.
  • Part III: Application of JMX Part III is where we see JMX positioned as a fundamental technology for new and fast-growing industries. Chapter 10, "J2EE and JMX," provides great detail, from one who was there, about how JMX's management of J2EE systems has been standardized with JSR077. It includes examples of how JMX works in real-world application server products. The last chapter looks to the future with Chapter 11, "Web Services and JMX." This chapter gives a brief description of what Web Services are and the management issues associated with them. It then illustrates how JMX can be used to make web-service-based applications manageable. It lays out how to manage the registry, the web services execution environment, and the web service itself.
  • Appendixes: The appendix of this book provide a reference to implementers and users of JMX technology. Appendix A lists JMX implementations, JMX-enabled management platforms, , and JMX-instrumented products.

Where to Download the Associated Code for This Book

The associated code files described in this book are available on Addison-Wesley's Web site at http://www.awprofessional.com/. Enter this book's ISBN (without the hyphens) in the Search box and click Search. When the book's title is displayed, click the title to go to a page where you can download the code.

Conventions Used in This Book

The following typographic conventions are used in this book:

  • Code lines, commands, statements, variables, and any text you see onscreen appears in a mono typeface. Bold mono typeface is often used to represent user types.
  • Placeholders in syntax descriptions appear in an italic mono typeface. Replace the placeholder with the actual filename, parameter, or other element it represents.
  • Italics highlight technical terms when they're being defined.
  • The ic:ccc icon is used before a line of code that is really a continuation of the preceding line. Sometimes a line of code is too long to fit as a single line on the page. If you see ic:ccc before a line of code, remember that it's part of the line immediately above it.
  • The book also contains Notes, Tips, and Cautions to help you spot important or useful information more quickly. Some of these are helpful shortcuts to help you work more efficiently.


0672324083P08272002

Index

Click below to download the Index file related to this title:
Index

Updates

Submit Errata

More Information

ONE MONTH ACCESS!

WITH PURCHASE


Get unlimited 30-day access to thousands of Books & Training Videos about technology, professional development and digital media If you continue your subscription after your 30-day trial, you can receive 30% off a monthly subscription to the Safari Library for up to 12 months.