5 Using JMX Connectors to Manage Resources Remotely

The Java Management Extensions Instrument Specification and the Agent Specification sections of Java Management Extensions (JMX) Specification, version 1.4 define the concept of connectors. A connector makes a JMX technology MBean server accessible to remote Java technology-based clients. The client end of a connector exports essentially the same interface as the MBean server.

A connector consists of a connector client and a connector server. The connector server is attached to an MBean server and listens for connection requests from clients. The connector client establishes a connection with the connector server. A connector client is usually in a different JVM from the connector server, and often runs on a different machine.

Many connector implementations are possible. In particular, there are many possibilities for the protocol used to communicate over a connection between client and server.

A connector server usually has an address, used to establish connections between connector clients and the connector server. Alternatively, some connectors can provide connection stubs to establish connections. The way in which connections are established depends on the discovery and lookup technology that you use. See Discovery and Lookup Services.

This chapter outlines the different types of connector defined by the JMX Remote API Specification section of Java Management Extensions (JMX) Specification, version 1.4 and the protocols that they use, in the following sections:

  • RMI Connector: The standard Remote Method Invocation (RMI) protocol must be supported by every implementation that conforms to the JMX Remote API Specification.
  • Generic Connector: The JMX Remote API Specification section also defines an optional protocol based directly on TCP sockets, called the JMX Messaging Protocol (JMXMP). An implementation of the specification can omit the JMXMP connector, but must not omit the RMI connector. The Java SE platform does not include the optional JMXMP connector.
  • User-Defined Protocols: A connector can also implement a protocol that is not defined in the JMX Specification.

RMI Connector

The JMX Remote API defines a standard protocol based on RMI. The RMI connector must be present in every implementation of the JMX Remote API.

The RMI connector supports the Java Remote Method Protocol (JRMP) transport.

The RMI connector over JRMP provides a simple mechanism for securing and authenticating the connection between a client and a server. This mechanism provides a basic level of security for environments using the RMI connector. Note that the generic JMXMP connector provides a more advanced level of security.

You can improve the security of the RMI connector over JRMP by using an RMI socket factory so that the connection between the client and the server uses the Secure Socket Layer (SSL).

Note:

JMX has a built-in filter to limit a set of classes allowed to be sent as a deserializing parameters over RMI to the server. Specify the filter's pattern with the com.sun.management.jmxremote.serial.filter.pattern management property in the $JAVA_HOME/conf/management/management.properties file. See Built-in Filters in Java Platform, Standard Edition Core Libraries for more information.

Generic Connector

The JMX Remote API defines an optional, generic connector, which is not included in the Java SE platform. This connector can be configured by adding pluggable modules to define the following:

  • The transport protocol used to send requests from the client to the server, and to send responses and notifications from the server to the clients
  • The object wrapping for objects that are sent from the client to the server and whose class loader can depend on the target MBean

The JMX Messaging Protocol (JMXMP) connector is a configuration of the generic connector where the transport protocol is based on TCP and the object wrapping is native Java serialization. Security is more advanced than for the RMI connector. Security is based on the Java Secure Socket Extension (JSSE), the Java Authentication and Authorization Service (JAAS), and the Simple Authentication and Security Layer (SASL).

The generic connector and its JMXMP configuration are optional, which means that they are not always included in an implementation of the JMX Remote API. The Java SE platform does not include the optional generic connector.

User-Defined Protocols

The JMX Remote API does not define a connector for every protocol. You can implement a connector based on a protocol that is not defined in the JMX Remote API. For example, you can implement connector based on a protocol that uses HTTP/S. The JMX Specification describes how to implement a connector based on a user-defined protocol.