Using a JMX Console
...
with ServiceMix
This document explains how to connect a JMX Console to ServiceMix. Two The following three open - source JMX Consoles will be discussed:
The ServiceMix JBIContainer exposes internal services and Components through JMX. The JBIContainer can be passed as a JMXBeanServer or, it can 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 thisthe following:
Code Block | ||
---|---|---|
| ||
String jndiPath = <container name> + "JMX"; JMXServiceURL url = new JMXServiceURL ("service:jmx:rmi:///jndi/rmi://<namingHost>:<namingPort>/" + jndiPath) ; JMXConnector connector = JMXConnectorFactory.connect(url); |
The following configuration variables are required for the next sections.
NOTE: The values shown are the default settings for ServiceMix.
Anchor | ||||
---|---|---|---|---|
|
Tip | ||
---|---|---|
| ||
The default namingPort is 1099 |
Using JConsole
...
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
...
. Please see the following sections for instructions on configuring and using JConsole with ServiceMix.
NOTE: This tool is available with the Java 5 release only.
How to Connect JConsole to Monitor ServiceMix
The following information will be needed: the This section explains how to configure JConsole to monitor ServiceMix. The ServiceMix port number, the ServiceMix container id, and the JMX Service URL will be required. This information was specified in the previous section, in the Default Settings box.
- ServiceMix should be running first. Please see the #Getting Getting Started Guide guide for instructions on running ServiceMix.
- Run Start JConsole from a command shell. The JConsole executable can be found in the
bin
directory of the J2SE installation directory.
The JConsole window will appear.Code Block cd [J2SE_install_dir]\bin jconsole
- Click on the "Advanced" tab. Enter the following The following URL must be entered in the box for "JMX URL" box: service:jmx:rmi:///jndi/rmi://localhosthostname:1099/defaultJBIJMXport/app_to_monitor. Where the
hostname
is name of the host on which the application to be monitored is running, theport
is the port number to connect to the application, and theapp_to_monitor
is the JMX enabled application to monitor. For example, if none of the defaults for ServiceMix have been modified and ServiceMix is running onlocalhost
, enter the following:service:jmx:rmi:///jndi/rmi://localhost:1099/defaultJBIJMX
.
. Double click on the thumbnail to see the full image.Panel borderColor #ccc title JConsole Agent borderStyle solid
- Click the Connect box to connect to the ServiceMix container. The ServiceMix MBeans
org.servicemix
will be visible in the console. Click on any one of them to see the statistics and perform monitoring functions.
org.servicemix
to see its MBeans.Panel borderColor #ccc title JConsole Management & Monitoring borderStyle solid
Testing JConsole with ServiceMix
- To see JConsole in action, start one of the ServiceMix examples running, for instance, the
...
- Basic Example:
Code Block cd [servicemix_install_dir]\examples\basic ..\..\bin\servicemix servicemix.xml
...
whereservicemix_install_dir
is the directory in which ServiceMix was installed.- Run JConsole (see the previous section) and click on
org.servicemix
. - Click on
org.servicemix.jbi.framework.ComponentMBeanImpl
. The components of the Basic example will be shown. Clicking on any of them will show the monitoring information available.Panel borderColor #ccc title JConsole Monitoring & Management Console borderStyle solid
Using MC4J
MC4J is a JMX Console. It can connect to J2EE servers, MBeans, and other applications to monitor them.
How to Connect MC4J to Monitor ServiceMix
This section explains how to configure MC4J to monitor ServiceMix. The ServiceMix port number, the ServiceMix container id, and the JMX Service URL will be required. This information was specified in a previous section in the Default Settings box. The server connection type will also be required - it is JSR160.
Then run JConsole and
Using MC4J
...
- ServiceMix should be running first. Please see the Getting Started guide for instructions on running ServiceMix.
- Click on the MC4J executable
MC4J Console 1.2b9.exe
(for Windows) to start MC4J. The executable can be found in the top-level directory of the MC4J installation. The MC4J window will appear. - Select "Management>Create Server Connection..." from the menu. This will start "My Wizard". The connection to ServiceMix can be created using the wizard.
Panel borderColor #ccc title MC4J My Wizard borderStyle solid - Enter the following into the text boxes/pull-down menus:
Select your server connection type: JSR160
Name: This can any name, for example, ServiceMix
Server URL: service:jmx:rmi:///jndi/rmi://localhost:1099/defaultJBIJMX
The Server URL isservice:jmx:rmi:///jndi/rmi://hostname:port/app_to_monitor
. Where thehostname
is name of the host on which the application to be monitored is running, theport
is the port number to connect to the application, and theapp_to_monitor
is the JMX-enabled application to monitor. For example, if none of the defaults for ServiceMix have been modified and ServiceMix is running onlocalhost
, enter the following:service:jmx:rmi:///jndi/rmi://localhost:1099/defaultJBIJMX
. - Accept the defaults for the rest of the fields in the Wizard.
- Click "Next."
- Click "Finish" in the next window.
A connection to ServiceMix has been added to MC4J!
Panel borderColor #ccc title MC4J
...
Connections borderStyle solid
...
Testing MC4J with ServiceMix
- To see MC4J in action, start one of the ServiceMix examples running, for instance, the file binding Example:
whereCode Block cd [servicemix_install_dir]\examples\file-binding ..\..\bin\servicemix servicemix.xml
servicemix_install_dir
is the directory in which ServiceMix was installed. - Run MC4J (see the previous section) and click on
org.servicemix
. - Click on
org.servicemix.jbi.framework.ComponentMBeanImpl
. The components of the File Binding example will be shown. Right-click on a component and select "Available dashboards...>Basic MBean View" to see the information shown in the diagram below. For more details on using MC4J, please see the MC4J documentation.Panel borderColor #ccc title MC4J
...
Console
...
borderStyle solid
...
ServiceMix JMX Console
ServiceMix comes with a WAR which can be deployed, including ServiceMix includes a simple JMX operational console. A ServiceMix WAR file can be created and deployed inside any Servlet / J2EE application server in a standard deployment unit. The added benefit of the ServiceMix WAR file is that it includes a simple JMX operational console as well allowing your JMX Console that allows a web browser to be used to view JMX attributes and statistics.
Starting the ServiceMix JMX Console
To create the ServiceMix WAR file from a fresh checkout source download of ServiceMix do the code try thisfollowing:
- Download and build the ServiceMix source code. Please see the Getting Started guide for instructions.
- Create the WAR file:
Code Block cd
...
[servicemix_install_dir]\tooling\servicemix-web maven war
...
whereservicemix_install_dir
is the directory to which ServiceMix was downloaded.- Deploy the WAR file into any servlet engine. Instructions for deploying ServiceMix on Tomcat, JBoss, and Geronimo can be found at the following links:
- Run the ServiceMix JMX Console. To do this enter the following URL in a web browser: http://localhost:8080/servicemix-web
Using the ServiceMix JMX Console
For examples of how to use the ServiceMix JMX Console, please see War Deployment.
Related Documentation
...