You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 15 Next »

Using a JMX Console With ServiceMix

This document explains how to connect a JMX Console to ServiceMix. Two open-source JMX Consoles will be discussed:

The ServiceMix JBIContainer exposes internal services and Components through JMX. The JBIContainer can be passed a JMXBeanServer or be configured to create one, if one doesn't exist. (see Configuration). If the JBIContainer creates its own MBeanServer instance, it also creates an RMI JMXConnector - to allow remote connections. The Ant Tasks use this:

Creating remote JMX Connector to the JBIContainer
String jndiPath = <container name> + "JMX";
JMXServiceURL url = new JMXServiceURL ("service:jmx:rmi:///jndi/rmi://<namingHost>:<namingPort>/" + jndiPath) ;
JMXConnector connector = JMXConnectorFactory.connect(url);


Default Settings

The default namingPort is 1099
The default container name is defaultJBI
The JMX Service URL is: service:jmx:rmi:///jndi/rmi://localhost:1099/defaultJBIJMX

Using JConsole and Java 5

The Java-2 Platform, Standard Edition (J2SE) 5.0 release includes a JMX monitoring tool, JConsole. JConsole monitors applications running on the Java platform and provides information on their performance and resource consumption. Please see Sun's documentation for more information on using this tool: http://java.sun.com/developer/technicalArticles/J2SE/jconsole.html

How to Use JConsole to Monitor ServiceMix

The following information will be needed: the ServiceMix port number, the ServiceMix container id, and the JMX Service URL. This information was specified in the previous section.

  1. ServiceMix should be running first. Please see the #Getting Started Guide for instructions on running ServiceMix.
  2. Run JConsole from a command shell. The JConsole executable can be found in the bin directory of the J2SE installation directory.
    cd [J2SE_install_dir]\bin
    jconsole
    
    The JConsole
  3. Click on the Advanced tab. Enter the following in the box for "JMX URL": service:jmx:rmi:///jndi/rmi://localhost:1099/defaultJBIJMX. Double click on the thumbnail to see the full image.
  4. Click the Connect box to connect to the ServiceMix container. The ServiceMix MBeans will be visible in the console. Click on any one of them to see the statistics and perform monitoring functions.

Testing JConsole with ServiceMix

To see JConsole in action, start one of the ServiceMix examples running, for instance, the
Basic Example:

cd [servicemix_install_dir]\examples\basic
..\..\bin\servicemix servicemix.xml

Then run JConsole and

Using MC4J

When you want to get at the ServiceMix MBeans using MC4J use JSR160 as your server connection type and the above default JMX Service URL as your server URL.

MC4J - JMX Console

MC4J - JMX Console view 2

ServiceMix JMX Console

ServiceMix comes with a WAR which can be deployed, including ServiceMix inside any Servlet / J2EE application server in a standard deployment unit. The added benefit of the ServiceMix WAR is it includes a simple JMX operational console as well allowing your web browser to view JMX attributes and statistics.

To create the ServiceMix WAR from a fresh checkout of the code try this

cd servicemix/tooling/servicemix-web
maven war

Then drop the WAR in any servlet engine.

  • No labels