2009/04/15 - Apache HiveMind has been retired.

For more information, please explore the Attic.

Jakarta > HiveMind
Jakarta
 
Font size:      

Setup JMX Connectors

Finally you have to decide how you want to access the management functionality of your application. The JMX specification calls the responsible components connectors and protocol adaptors. The HTML protocol adaptors have the big advantage, that no additional management console is needed. All that is needed is a web browser.
HiveMind offers preconfigured services for the most common connectors.

HTML Adaptors

HTML Adaptors are provide by MX4J and Sun RI.

MX4J HTML Adaptor

Enable the MX4J HTML Adaptor by including these lines in your descriptor:

<contribution configuration-id="hivemind.management.MBeans">
   <mbean service-id="hivemind.management.connector.MX4JHttpAdaptorMBean" 
          start-method="start" />
</contribution>

By default the adaptor listens on port 9000 for incoming HTTP request and renders a HTML user interface.
To change the port, modify the symbol "management.http.Port":

<contribution configuration-id="hivemind.ApplicationDefaults">
  <default symbol="management.http.Port" value="9001" />
</contribution>

SUN RI HTML Adaptor

Enable the SUN HTML Adaptor by including these lines in your descriptor:

<contribution configuration-id="hivemind.management.MBeans">
   <mbean service-id="hivemind.management.connector.SunHttpAdaptorMBean" 
          start-method="start" />
</contribution>

The default port and configuration of the port correspond to the MX4J description above.

J2SE 1.5 and HTML Adaptors

There is no HTTP Adaptor provided with J2SE 1.5. But you can combine the MX4J or Sun RI HTTP Adaptors with J2SE 1.5. Just include the xxx-tools.jar in the classpath and setup the adaptor like described above.

JSR 160 connectors

JSR 160 connectors allow the remote management of the application using any management console that supports that standard (like JConsole, MC4J). The connectors are created by a standardized api so there are no implementation specific MBeans like with HTTP Adaptors.
The standard allows use of different protocols for the remote management (which must be supported by both the JMX implementation and the management console). Most common is a RMI protocol and this is what HiveMind uses by default. The protocol requires a running RMI Registry.
Add these lines:

<contribution configuration-id="hivemind.management.MBeans">
   <mbean service-id="hivemind.management.connector.NamingServiceMBean" 
      start-method="start" />
   <mbean service-id="hivemind.management.connector.JMXConnectorServerMBean" 
      start-method="start" />
</contribution>

Now you can connect to the application with jconsole or MC4J using this url: service:jmx:rmi://localhost/jndi/rmi://localhost:1099/jmx .

You can change RMI port and the service url this way:

<contribution configuration-id="hivemind.ApplicationDefaults">
  <default symbol="management.namingservice.port" value="1099" />
  <default symbol="management.jmxconnector.ServiceUrl" 
      value="service:jmx:rmi://localhost/jndi/rmi://localhost:1099/jmx" />
</contribution>

J2SE 1.5 local connector

Local management with jconsole is possible without adding any connector, if your application runs on J2SE 1.5. Simply set the system property com.sun.management.jmxremote before launching your app:

java -Dcom.sun.management.jmxremote ...