JMX Tools Reference Guide
JMX Tools Reference Guide
Version: 3.3.0.M5
1. Introduction ................................................................................................................. 1
1.1. What is JMX Tools? ........................................................................................... 1
1.2. Key Features of JMX Tools ................................................................................. 3
2. JMX Tools Tasks ......................................................................................................... 5
2.1. Quick Start ......................................................................................................... 5
2.2. Managing Application .......................................................................................... 5
2.3. Tomcat Managing ............................................................................................... 9
2.4. Managing a JBoss application server Remotely .................................................... 9
2.5. Extension Task ................................................................................................. 10
2.5.1. Why you extend the framework ............................................................... 10
2.5.2. Core Extensions ..................................................................................... 10
2.5.3. UI Extensions ........................................................................................ 10
2.6. Connections Creation Task ................................................................................ 11
2.6.1. Establishing Connection .......................................................................... 11
3. References ................................................................................................................. 13
3.1. MBean Explorer ................................................................................................ 13
3.2. MBean Editor .................................................................................................... 15
3.2.1. Notifications Page .................................................................................. 17
4. Summary .................................................................................................................... 19
4.1. Other relevant resources on the topic ................................................................ 19
iii
iv
Chapter 1.
Introduction
JBoss Tools' JMX project is a fork of eclipse-jmx [http://code.google.com/p/eclipse-jmx/], a project
by Jeff Mesnil. It was forked with permission.
This chapter covers the basics of working with JMX plugin™, which is used to manage Java
applications (with Managed Beans) through JMX and its RMI Connector.
1
Chapter 1. Introduction
2
Key Features of JMX Tools
3
4
Chapter 2.
The MBean Explorer lists all the domains, MBeans, attributes, and operations inside a
connection. When you double-click an MBean in the MBean Explorer, it opens a multi-page editor
to manage the MBean. The MBean Editor is composed of these pages:
3. Compile the example Java classes from within where you unpacked the files directory.
javac com/example/*.java
4. Start the Main application, specifying the properties that expose Main for remote management:
java -Dcom.sun.management.jmxremote.port=9999 \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.ssl=false \
com.example.Main
5
Chapter 2. JMX Tools Tasks
5. Now launch the Eclipse IDE, in Eclipse open the MBean Explorer. Go to Window → Show
View → Other, select MBean Explorer, and then click the OK button)
7. In the Create JMX Connection dialog, click the Next button and then click the Advanced tab.
service:jmx:rmi:///jndi/rmi://:9999/jmxrmi
6
Managing Application
9. Click the Finish button to establish the connection with the application.
10.Now expand the connection you have just created, open the com.example package, and click
the sayHello() method.
11.In the MBean Editor go to the Operation Details section and click the sayHello() button.
7
Chapter 2. JMX Tools Tasks
8
Tomcat Managing
12.The final step is to make sure the application worked as expected. Open the terminal where
you launched the application in step 3. You should see output similar to the following:
Currently, JMX Tooling is able to connect to Tomcat without authentication or with password-
based authentication.
Using SSL for authentication is not supported: you need to make sure that the System property
com.sun.management.jmxremote.ssl is set to false.
More information to manage Tomcat can be found in the Tomcat management documentation
[http://tomcat.apache.org/tomcat-7.0-doc/].
Important
If you are running JBos Enterprise Application Platform 6, JBoss Application Server
7 or later, you can connect automatically to a remote server through the Server
Behaviour tab in the server settings. For further information on this see the JBoss
Server Manager Reference Guide for this release.
The JBoss JMX Tools allow you to easily access and manage a JBoss server remotely. In order
to connect to a remote instance of a JBoss server, you need to run the server or make sure the
server is launched.
1. Select Window → Open Perspective → Other and select the JMX perspective option.
2. Switch to the MBean Explorer by selecting Window → Show View → Other and selecting
the MBean Explorer option.
9
Chapter 2. JMX Tools Tasks
in
the MBean Explorer menu bar.
4. Select the Advanced tab and set the JMX URL to:
service:jmx:rmi://localhost/jndi/rmi://localhost:1090/jmxconnector
Please note that in this example we are connected to the local host.
2.5.3. UI Extensions
There are two extension points currently approved for use in the UI
10
Connections Creation Task
Similarly, some connection types may be able to be created, and others may not. The default
connection type, for example, can be created and deleted at will. The AS Tools connection type,
which represents a JBoss server, does not allow you this level of control. A JBoss JMX connection
is created when a JBoss server is created in the server's view, and deleted when said server
is deleted. The JMX connection for this server is in the connected state only when the server is
started.
The simple method is to specify the host, port (and optionally user name and password) and click
the OK button.
On the Advanced tab you can set the server name (it will be displayed in MBean Explorer), and
a URL to the remote server. For example, to connect to JBoss AS you need to set the JMX URL to
service:jmx:rmi://localhost/jndi/rmi://localhost:1090/jmxconnector
If it is required you can enter user name and password for the server connection.
Note
11
12
Chapter 3.
References
3.1. MBean Explorer
The MBean Explorer displays the MBean features (both attributes and operations) in its hierarchy.
Double-clicking on a feature will open an MBean Editor, displaying the page corresponding to the
feature type and select the feature.
to synchronize selections between the active MBean Editor and the MBean Explorer (and vice
versa).
The MBean Explorer has also a filter that can be used to filter the available MBeans to show
those that interest you.
13
Chapter 3. References
For example, if you are only interested by MBeans related to memory, typing "memo" will show
any node (domain, mbean, attribute, or operation) that matches that text, as well as that node's
parents and children. So if an MBean matches, all attributes and operations from that bean will
be displayed. If, however, an attribute or operation name (a leaf node) matches, only that node
and its parents in the tree will be displayed.
on the MBean Explorer toolbar is used to collapse all the MBeans and display only the domains.
It is also possible to double click on a node to expand or collapse it.
14
MBean Editor
The Attributes and Operations pages display a list for either the MBean attributes or operations,
as well as details about the selection.
It is possible to toggle the layout between the list and the details either
vertically (by default) or horizontally with the help of the special icons
15
Chapter 3. References
16
Notifications Page
Note
It is only possible to subscribe to an MBean that emits notifications (i.e. they must
be a NotificationBroadcaster).
17
18
Chapter 4.
Summary
This document has provided an overview of the functionality included with JXM Tools, as well
as walking you through the steps on managing Tomcat, Eclipse Equinox or JBoss Instances and
how to create new JMX connections. If you have questions or suggestions concerned both the
documentation and tools behavior, you are welcome to JBoss Tools Users forum. Please, use
Jira to report bugs and requests on documentation.
For more information about JMX technology please visit JMX Technology Home Page [http://
java.sun.com/javase/technologies/core/mntr-mgmt/javamanagement/]
19
20