You are previewing Java™ and JMX: Building Manageable Systems.
O'Reilly logo
Java™ and JMX: Building Manageable Systems

Book Description

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

Table of Contents

  1. Copyright
    1. Dedication
  2. Preface
    1. Introduction
    2. This Book's Intended Audience
    3. What You Need to Know before Reading This Book
    4. What You Will Learn from Reading This Book
    5. Software Needed to Complete the Examples
    6. How This Book Is Organized
    7. Where to Download the Associated Code for This Book
    8. Conventions Used in This Book
    9. About the Cover
    10. Acknowledgments
  3. I. JMX Introduction
    1. 1. Management Concepts
      1. 1.1. Progress of Management
        1. 1.1.1. Why Invest in Management?
        2. 1.1.2. The Natural Evolution of Management
      2. 1.2. Management Architectures
        1. 1.2.1. Managed Resource
        2. 1.2.2. Agent
        3. 1.2.3. Subagent
        4. 1.2.4. Midlevel Manager
        5. 1.2.5. Management System
      3. 1.3. Management Technologies
        1. 1.3.1. Proprietary Technologies
        2. 1.3.2. Standard Technologies
          1. 1.3.2.1. SNMP
          2. 1.3.2.2. CMIP
          3. 1.3.2.3. CIM/WBEM
          4. 1.3.2.4. JMX
          5. 1.3.2.5. AIC
          6. 1.3.2.6. ARM
      4. 1.4. Managing the Lifecycle
      5. 1.5. Management Disciplines
        1. 1.5.1. Distribute
        2. 1.5.2. Install
        3. 1.5.3. Configure
        4. 1.5.4. Monitor
        5. 1.5.5. Control
      6. 1.6. Managed Resource Responsibilities
        1. 1.6.1. Management Data
        2. 1.6.2. Management Operations
        3. 1.6.3. Management Instrumentation
          1. 1.6.3.1. External Instrumentation
          2. 1.6.3.2. Internal Instrumentation
      7. 1.7. Management Patterns
        1. 1.7.1. Event Generator
        2. 1.7.2. Noninterruptible
        3. 1.7.3. Queryable
        4. 1.7.4. Operational
      8. 1.8. Management Applications
        1. 1.8.1. Distribution Applications
        2. 1.8.2. Inventory Applications
        3. 1.8.3. Topology Applications
        4. 1.8.4. Configuration Applications
        5. 1.8.5. Operations Applications
        6. 1.8.6. Event and Automation Applications
        7. 1.8.7. Monitoring and Performance Applications
      9. 1.9. Summary
      10. 1.10. General References
        1. Bibliography
      11. Notes
    2. 2. Introduction to JMX[1]
      1. 2.1. Why We Need JMX
        1. 2.1.1. Choosing a Management Technology
        2. 2.1.2. Dealing with Diversity
          1. 2.1.2.1. Centralized Applications
          2. 2.1.2.2. Distributed Applications
          3. 2.1.2.3. Internet Applications
          4. 2.1.2.4. E-Business Applications
          5. 2.1.2.5. Service-Oriented Applications
        3. 2.1.3. Being Managed by Multiple Management Applications
        4. 2.1.4. Supporting Application-Specific Management Systems
      2. 2.2. Which Applications Should Be Manageable?
        1. 2.2.1. Complex Applications
        2. 2.2.2. High-Volume Applications
        3. 2.2.3. Mission-Critical Applications
        4. 2.2.4. Corporate Applications
        5. 2.2.5. Applications with Expectant Customers
      3. 2.3. The Goals of JMX
        1. 2.3.1. Simple API
        2. 2.3.2. Dynamic Management
        3. 2.3.3. Isolation
        4. 2.3.4. Generic Management
      4. 2.4. History
        1. 2.4.1. JMAPI
        2. 2.4.2. JDMK
        3. 2.4.3. JMX
        4. 2.4.4. The Specification and Compliance
          1. 2.4.4.1. Compliance at the Instrumentation Level
          2. 2.4.4.2. Compliance at the Agent Level
          3. 2.4.4.3. Support at the Agent Level
          4. 2.4.4.4. Compliance at the Distributed Services Level
          5. 2.4.4.5. Compliance at the Management Level
        5. 2.4.5. The Reference Implementation
      5. 2.5. JMX Overview
        1. 2.5.1. JMX-Managed Resources
        2. 2.5.2. MBeans
          1. 2.5.2.1. Standard MBeans
          2. 2.5.2.2. Dynamic MBeans
          3. 2.5.2.3. Open MBeans
          4. 2.5.2.4. Model MBeans
        3. 2.5.3. JMX Agents
          1. 2.5.3.1. The MBeanServer
          2. 2.5.3.2. Required Services
        4. 2.5.4. JMX Adapters
        5. 2.5.5. Adapter Tools
      6. 2.6. Quick Tour of JMX
        1. 2.6.1. todd, the Time of Day Daemon
        2. 2.6.2. todd Management
        3. 2.6.3. todd's MBeans
        4. 2.6.4. Incorporating an MBeanServer
        5. 2.6.5. Monitoring todd
        6. 2.6.6. Browser Control
      7. 2.7. Summary
      8. Notes
  4. II. JMX Details
    1. 3. All about MBeans
      1. 3.1. MBean Fundamentals
        1. 3.1.1. The Management Interface
        2. 3.1.2. The Introspection Algorithm
      2. 3.2. MBean Construction
        1. 3.2.1. Standard MBeans
        2. 3.2.2. Dynamic MBeans
          1. 3.2.2.1. MBeanInfo Classes
          2. 3.2.2.2. Using Dynamic MBeans
        3. 3.2.3. Active MBeans
          1. 3.2.3.1. JMX Notifications
          2. 3.2.3.2. Activating the Apache MBean
        4. 3.2.4. Open MBeans
          1. 3.2.4.1. Basic Data Types
            1. Primitives
            2. Primitive Objects
            3. Aggregate Types
            4. ObjectName
          2. 3.2.4.2. OpenMBeanInfo
          3. 3.2.4.3. Using Open MBeans
      3. 3.3. Design Guidelines
      4. 3.4. Summary
    2. 4. Model MBeans
      1. 4.1. Introduction
        1. 4.1.1. The Simplest Model MBean Example
      2. 4.2. The ModelMBean Interface
        1. 4.2.1. DynamicMBean
        2. 4.2.2. PersistentMBean
        3. 4.2.3. ModelMBeanNotificationBroadcaster
      3. 4.3. Managed Resources
      4. 4.4. ModelMBeanInfo
      5. 4.5. Descriptors
        1. 4.5.1. Model MBean Descriptors
        2. 4.5.2. Attribute Descriptors
        3. 4.5.3. Constructor Descriptors
        4. 4.5.4. Operation Descriptors
        5. 4.5.5. Notification Descriptors
      6. 4.6. Behavior of the Model MBean
        1. 4.6.1. Caching
        2. 4.6.2. Values and Validation
        3. 4.6.3. Delegation
        4. 4.6.4. Persistence
        5. 4.6.5. Logging
        6. 4.6.6. Miscellaneous Descriptors
          1. 4.6.6.1. Presentation String
          2. 4.6.6.2. Visibility
          3. 4.6.6.3. Export
          4. 4.6.6.4. Protocol Map
      7. 4.7. XML Service: Priming ModelMBeanInfo from XML Files
      8. 4.8. Using Model MBeans
        1. 4.8.1. Creating Static Model MBeans
        2. 4.8.2. Creating Dynamic Model MBeans
          1. 4.8.2.1. Creating Model MBeans from the Managed Resource
          2. 4.8.2.2. Creating Model MBeans by an External Force: Assigning a Managed Resource
        3. 4.8.3. Adding Custom Descriptors
        4. 4.8.4. Overriding the RequiredModelMBean Class
      9. 4.9. Common Mistakes with Model MBeans
      10. 4.10. Caveats
        1. 4.10.1. Transactionality
        2. 4.10.2. Remoteness
      11. 4.11. Summary
      12. 4.12. XML File Example
      13. Notes
    3. 5. The MBeanServer
      1. 5.1. The MBeanServerFactory Class
      2. 5.2. Object Naming
        1. 5.2.1. Object Name Domains
        2. 5.2.2. Object Name Key Properties
        3. 5.2.3. The ObjectName Class
        4. 5.2.4. The ObjectInstance Class
      3. 5.3. The MBeanServer Interface
        1. 5.3.1. MBean Lifecycle Methods
          1. 5.3.1.1. Instantiation
          2. 5.3.1.2. Registration
          3. 5.3.1.3. Creation
          4. 5.3.1.4. The MBeanRegistration Interface
          5. 5.3.1.5. Deregistration
        2. 5.3.2. MBean Access Methods
        3. 5.3.3. MBeanServer Methods
      4. 5.4. The MBeanServerDelegate MBean
      5. 5.5. Finding MBeans
        1. 5.5.1. Query Expressions
        2. 5.5.2. Query Scope and Pattern Matching
        3. 5.5.3. MBeanServer Query Methods
      6. 5.6. Notifications
      7. 5.7. Summary
    4. 6. Monitors and Monitoring
      1. 6.1. The JMX Monitor Service
        1. 6.1.1. The Monitoring Package Structure
        2. 6.1.2. The Monitor MBean
        3. 6.1.3. MonitorNotification
      2. 6.2. Concrete Monitors
        1. 6.2.1. Monitoring Apache's Status
          1. 6.2.1.1. Apache MBean Refresher
        2. 6.2.2. Canonical Usage Pattern
          1. 6.2.2.1. Creating and Configuring the Monitor
          2. 6.2.2.2. Listening for Notifications
        3. 6.2.3. StringMonitor
          1. 6.2.3.1. Using StringMonitor
        4. 6.2.4. CounterMonitor
          1. 6.2.4.1. Using CounterMonitor
        5. 6.2.5. GaugeMonitor
          1. 6.2.5.1. Using GaugeMonitor
      3. 6.3. Summary
    5. 7. JMX Agent Services
      1. 7.1. Timer Service
        1. 7.1.1. The Notification Queue
        2. 7.1.2. Timer Notifications
        3. 7.1.3. The Timer Class
          1. 7.1.3.1. TimerMBean Attributes
          2. 7.1.3.2. Timer Notification Operations
          3. 7.1.3.3. Starting and Stopping
      2. 7.2. Dynamic MBean Loading Service
        1. 7.2.1. The MLET Tag
        2. 7.2.2. MLet Examples
        3. 7.2.3. The MLet API
          1. 7.2.3.1. MLet Constructors
          2. 7.2.3.2. MLetBean Attributes
          3. 7.2.3.3. MLet Operations
      3. 7.3. Relation Service
        1. 7.3.1. A Simple Example: The SessionPool Relation
        2. 7.3.2. The RelationService Class
          1. 7.3.2.1. RelationService Attributes
          2. 7.3.2.2. RelationType Operations
          3. 7.3.2.3. Relation Operations
          4. 7.3.2.4. Query Operations
      4. 7.4. JMX Connectors
        1. 7.4.1. Connector MBean
        2. 7.4.2. Connector Client Proxy
          1. 7.4.2.1. Connector Client Factory
          2. 7.4.2.2. Security
      5. 7.5. Summary
    6. 8. Securing JMX
      1. 8.1. JMX Security Exposures
      2. 8.2. Permission-Based Security Fundamentals
        1. 8.2.1. Permissions
        2. 8.2.2. SecurityManager
        3. 8.2.3. Policy
      3. 8.3. JMX Permissions
        1. 8.3.1. MBeanServerPermission
        2. 8.3.2. MBeanTrustPermission
        3. 8.3.3. MBeanPermission
      4. 8.4. Using JMX Security
        1. 8.4.1. A Simple Process Management Application (SPMA)
        2. 8.4.2. Running with Security Enabled
        3. 8.4.3. Policy Configuration
      5. 8.5. Summary
    7. 9. Designing with JMX
      1. 9.1. MBeanServer Deployment Patterns
        1. 9.1.1. Daemon
          1. 9.1.1.1. Adapters
          2. 9.1.1.2. Discovery
          3. 9.1.1.3. Remoteness
        2. 9.1.2. Component
        3. 9.1.3. Driver
      2. 9.2. Instrumentation Patterns
        1. 9.2.1. Applications as MBeans
        2. 9.2.2. MBeans on Behalf of Applications
        3. 9.2.3. Publish-Only MBeans
        4. 9.2.4. Facades for Distributed Applications
      3. 9.3. MBean Registration and Lifecycle
        1. 9.3.1. Registration by Application
        2. 9.3.2. Registration by Third Party
        3. 9.3.3. Registration by Management Adapter
        4. 9.3.4. Registration by MBeanServer Bootstrap
      4. 9.4. Best Practices
        1. 9.4.1. MBean Granularity
        2. 9.4.2. Application Self-Management
          1. 9.4.2.1. Application-Specific Manager
          2. 9.4.2.2. Local Monitoring and Recovery
        3. 9.4.3. Resource Schema
        4. 9.4.4. Notifications and Logging
        5. 9.4.5. Federation Options
          1. 9.4.5.1. Single-Agent View
          2. 9.4.5.2. Multiple-Agent View
      5. 9.5. Summary
  5. III. Application of JMX
    1. 10. J2EE and JMX
      1. 10.1. Java 2 Enterprise Edition
      2. 10.2. J2EE Management
      3. 10.3. Management Tool Access: The MEJB
      4. 10.4. J2EE Management Models
        1. 10.4.1. The Base Managed-Object Model
        2. 10.4.2. The Management Domain Model
        3. 10.4.3. The J2EE Application Server Model
        4. 10.4.4. J2EE Application Component Models
        5. 10.4.5. J2EE Server Runtime Components
      5. 10.5. Standard Management Functions
        1. 10.5.1. State Management
        2. 10.5.2. Event Generation
        3. 10.5.3. Performance Monitoring
        4. 10.5.4. Stats Interface Details
      6. 10.6. Application-Specific Extensions
      7. 10.7. Areas Missing from J2EE Management
      8. 10.8. The Vision
      9. 10.9. Sample JSR 77 Code
      10. 10.10. Summary
      11. Notes
    2. 11. Web Services and JMX
      1. 11.1. Web Services Overview
        1. 11.1.1. Service-Oriented Architecture
        2. 11.1.2. Web Service Stack
      2. 11.2. Web Service Registry Management
        1. 11.2.1. Registry Owner
        2. 11.2.2. Registry User
      3. 11.3. Web Service Execution Environment Management
        1. 11.3.1. Execution Environment Owner
        2. 11.3.2. Execution Environment User
      4. 11.4. Web Service Management
        1. 11.4.1. Web Service Owner
          1. 11.4.1.1. Web Service Management through the Execution Environment
          2. 11.4.1.2. Web Service Management Directly with the Web Service
            1. 1. The Web Service Manages Its Own MBean
            2. 2. The Web Service Augments the Execution Environment's MBean
            3. 3. The Web Service Publishes Management portType and port
        2. 11.4.2. Web Service User
      5. 11.5. Summary
      6. 11.6. Code Listings
        1. 11.6.1. UDDIRegistryClientManagerMBean Implementation
          1. 11.6.1.1. UDDIRegistryClient Class
          2. 11.6.1.2. UDDIRegistryClientManagerMBean Interface
          3. 11.6.1.3. UDDIRegistryClientManager Class
        2. 11.6.2. WebServiceRuntimeManagerMBean Implementation
        3. 11.6.3. WebServiceManagerMBean Implementation
        4. 11.6.4. StockQuote Service WSDL Document
      7. Notes
    3. JMX in Products
      1. A.1. JMX Agent Implementations
        1. A.1.1. JMX 1.0 Reference Implementation from Sun Microsystems
        2. A.1.2. JDMK 4.2 from Sun Microsystems
        3. A.1.3. TMX4J 1.0 from Tivoli Systems
        4. A.1.4. AdventNet Agent Toolkit Java/JMX Edition[12]
        5. A.1.5. AdventNet ManageEngine
        6. A.1.6. MX4J
      2. A.2. JMX Managers
        1. A.2.1. Tivoli Web Component Manager
        2. A.2.2. Dirig Software
        3. A.2.3. AdventNet Middleware Manager
        4. A.2.4. AdventNet Web NMS
        5. A.2.5. Vigor Soft hawkEye[21]
      3. A.3. JMX-Enabled Products
        1. A.3.1. IBM WebSphere 5.0
        2. A.3.2. IBM Web Services Tool Kit 3.1
        3. A.3.3. IBM WebSphere Voice Server
        4. A.3.4. IBM WebSphere Business Components Composer
        5. A.3.5. BEA Systems WebLogic Server 7.0[22]
        6. A.3.6. IONA iPortal[23]
        7. A.3.7. IONA Technologies PLC: Orbix E2A XMLBus Edition 5.3
        8. A.3.8. Hewlett-Packard OpenView
        9. A.3.9. Hewlett-Packard Core Services Framework
        10. A.3.10. JBoss
        11. A.3.11. Sonic Software SonicXQ[24]
        12. A.3.12. Pramati Server from Pramati Technologies[25]
        13. A.3.13. Sybase EAServer 4.0
        14. A.3.14. Sun Microsystems: Sun ONE Application Server
        15. A.3.15. Sun Microsystems: Sun ONE Portal Server
        16. A.3.16. Compiere Open Source ERP & CRM
      4. Notes