Howto: JSR 160 support in JOnAS

The content of this document is the following:

  1. Target Audience and Rationale
  2. What is JSR 160 ?
  3. Connector servers created by JOnAS

Target Audience and Rationale

Starting with version 4.1.4 JOnAS provides support for remote connection to the MBean server in a standard way.

The target audience for this document is the management application developer or the administrator, intending to use standard JMX RMI connectors to access the MBean Server running in a JOnAS server.

What is JSR 160 ?

The JSR 160 is a JMX Remoting specification which extends the JSR 3 specification by providing a standard API to connect to remote JMX-enabled applications.

Currently, JSR 160 has defined a mandatory connector based on RMI (that supports both RMI/JRMP and RMI/IIOP).

Support for JSR 160 connectors in JOnAS is based on the MX4J JMX implementation.

Connector servers created by JOnAS

Previous and current JOnAS versions implement a proprietary remote object allowing connection to the MBean server. This object is registered in JNDI under the name 'RMIConnector_jonasServerName'. It can be accessed using any of the communication protocols support by JOnAS (RMI/JRMP, RMI/IIOP, JEREMIE - see Choosing the Protocol).

JSR 160 support implies providing standard connector server objects. The JMX service creates at start-up one or several such objects, depending on the JOnAS configuration (in this case, depending on the content of carol.properties file). To create a client connector, the client side needs to know the URL of the connector server. Below we present the URLs that can be used by the clients depending on the protocol they choose.

Currently only 2 protocols can be used by JSR-160 connectors: RMI/JRMP and RMI/IIOP.

Using a RMI/JRMP Connector

This connector can be used if the jrmp protocol is set in the carol.protocols list.

The client has to construct a JMXServiceURL using the following String, possibly modified according to the JOnAS-specific configuration: service:jmx:rmi:///jndi/rmi://host:port/jrmpconnector_jonasServerName where host is the host on which is running the JOnAS server to be managed. The port number is given in the carol.properties file.

Then, a JMXConnector has to be created and connected to the connector server using the JMX Remote API.

Example 1:

 
	Hashtable environment = null;   
	JMXServiceURL address = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://host:1099/jrmpconnector_jonas");
	JMXConnector connector = JMXConnectorFactory.newJMXConnector(address, environment);
	connector.connect(environment);

Using a RMI/IIOP Connector

This connector can be used if the iiop protocol is set in the carol.protocols list.

The client code is similar to the JRMP case, but the String to be used to construct the JMXServiceURL must adhere to the following model: "service:jmx:iiop:///jndi/iiop://host:port/iiopconnector_jonasServerName"

Example 2:

 
	Hashtable environment = null;   
	JMXServiceURL address = new JMXServiceURL("service:jmx:iiop:///jndi/iiop://host:2001/iiopconnector_jonas");
	JMXConnector connector = JMXConnectorFactory.newJMXConnector(address, environment);
	connector.connect(environment);