JMX

The Java Management Extensions (JMX) specification defines the architecture, services, and API for the distributed management of resources using Java. JMX can be used to instrument everything from network hardware to applications, enabling you to build your own applications that manage these instrumented resources. This chapter focuses on how WebLogic Server is itself instrumented, and how this enables you to create applications that monitor and manage various aspects of a WebLogic domain and its deployed applications.

WebLogic's JMX implementation, and the specification itself, comprise three levels: an instrumentation, agent, and distribution level. The instrumentation level provides a design for implementing JMX-manageable resources. Within WebLogic, the manageable resources include just about everything, ranging from connection pools and security realms to the domain configuration and the state of a deployed application. The instrumentation of a resource is provided by MBeans, which expose an interface for the management and control of that resource. For instance, the MBeans for a JDBC connection pool expose attributes such as the pool's name and size, as well as operations such as resetting the pool or shutting it down. Runtime statistics are also made available, such as the maximum number of connections to the pool and the connection delay time.

The agent level builds upon the instrumentation level to provide a standardized way of managing MBeans. In WebLogic, this is realized by an MBean Server, which hosts the MBeans on an individual WebLogic instance and lets clients access, retrieve, and modify MBeans on the MBean Server. You typically would write management applications that interact with the MBean Server and its hosted MBeans. For example, you can write an application that locates all JDBC connection pool MBeans and ensures that they don't have unacceptable connection time delays. WebLogic supports two ways of interacting with MBeans. You could either adopt the standard approach put forward in the JMX specification or use a WebLogic-specific type-safe interface. The standard approach provides a generic interface for accessing any MBean. For example, in order to invoke an operation on an MBean, you need to pass the operation name and an array of arguments to an invocation method. WebLogic's type-safe implementation exposes an individual interface for each MBean, thereby making manipulating MBeans as easy as using traditional JavaBeans.

As WebLogic domains are distributed, the manageable resources are themselves spread across a number of server instances. WebLogic's JMX architecture provides each WebLogic instance with its own MBean Server. WebLogic's distribution level defines precisely how MBeans are made accessible through this distributed management architecture. For example, when a Managed Server instance starts up, it contacts the Administration Server for a set of MBeans that describes its local configuration. The Managed Server then uses these local configuration MBeans to establish the services that have been configured for the server.

The JMX specification provides two powerful additions to this framework that allow you to build effective management applications. The MBean notification model allows MBeans to broadcast management events, called notifications. By registering a listener class with an MBean, you can be alerted when a notification has been broadcast and can react to it appropriately. The Monitor MBean architecture provides the second management enhancement. This architecture defines a set of MBeans that monitor other MBeans, observing specific attribute values as they vary over time and automatically firing notifications when these values exceed specified thresholds. For instance, you could configure a monitor MBean to observe the connection count value on a connection pool and alert you when the pool exceeds specified thresholds.

All of these facilities provide you with the means to create applications that enable you to remotely configure, monitor, and manage the different aspects of your WebLogic domain and the applications deployed to it. You can programmatically monitor and manipulate a WebLogic deployment, leading to exciting opportunities. For instance, a management application could constantly monitor the status of JMS servers, and in the case of failure, automatically migrate the service to an alternate WebLogic Server a service not provided by the standard JMS tooling in WebLogic. The Administration Console is itself an example of a remote management application. In fact, it is nothing more than a web-based tool that allows Administrators and Deployers to remotely manipulate MBeans.

WebLogic has literally hundreds of instrumented services, and it would be senseless to explain each one in detail. In addition, any deployments such as EJBs or servlets become manageable resources as well. Instead of looking at each MBean in detail, something that is covered by the JavaDoc APIs, this chapter will teach you how to effectively use WebLogic's JMX implementation. You will learn about WebLogic's distributed JMX architecture, and how to access and manipulate MBeans to configure, manage, and monitor a wide range of managed services. En route, a number of code examples will demonstrate how to use particular MBeans. You will also see an example of using the WLShell tool, which provides a scripting environment for navigating the MBeans in a running WebLogic instance. You can use this tool to script MBean actions, such as modifying a domain configuration, or simply to view MBean attributes and invoke operations.

Introduction

Web Applications

Managing the Web Server

Using JNDI and RMI

JDBC

Transactions

J2EE Connectors

JMS

JavaMail

Using EJBs

Using CMP and EJB QL

Packaging and Deployment

Managing Domains

Clustering

Performance, Monitoring, and Tuning

SSL

Security

XML

Web Services

JMX

Logging and Internationalization

SNMP



WebLogic. The Definitive Guide
WebLogic: The Definitive Guide
ISBN: 059600432X
EAN: 2147483647
Year: 2003
Pages: 187

Flylib.com © 2008-2020.
If you may any questions please contact us: flylib@qtcs.net