If you are interested in contributing to this FAQ, please read the Contribution Guidelines.
Q: How do I connect to the broker using jconsole ?
A: jconsole is a JMX monitoring tool that is bundled with the JDK. You can connect to the broker using jconsole as a local process (ie a broker running on the same machine as jconsole) or as a remote process.
Local process
If you are using JDK 1.6 for the broker and jconsole, you can simply launch jconsole and the broker process will appear in the local process list. Select it and you will be monitoring the broker. No credentials are required here as long as you are running the broker and jconsole as the same user. Note that there is a bug in JDK 1.6 that causes the broker to exit when jconsole is used to connect to it as a local process: 6583000 - Attaching to local MQ broker process via jconsole causes broker JVM to seg fault
. This bug is fixed in JDK 1.6u10.
If you are using JDK 1.5, the broker needs to be started up with additional command line options to allow for local process monitoring. This is done by starting up the broker using the '-vmargs' option to specify the 'com.sun.management.jmxremote' property to the Java VM as follows:
-vmargs -Dcom.sun.management.jmxremoteFor example:
imqbrokerd -tty -name mybroker -vmargs -Dcom.sun.management.jmxremoteOnce the above is done, the broker process will appear in jconsole's local process list.
% imqcmd list jmx Listing JMX Connectors on the broker specified by: ------------------------- Host Primary Port ------------------------- localhost 7676 Name Active URL jmxrmi true service:jmx:rmi://yourhost/stub/rO0ABdmVyLlJlpIDJyGvQkwAAAARod97VdgAEAeA== ssljmxrmi false Successfully listed JMX Connectors.The URL seen above (shortened for convenience) i.e.
service:jmx:rmi://yourhost/stub/rO0ABdmVyLlJlpIDJyGvQkwAAAARod97VdgAEAeA==can be used to connect to the broker.
![]() |
![]() |
-startRmiRegistryAs the option suggests, an RMI registry will be launched as part of broker startup. The default RMI port used here is 1099. If this port is used on your machine, a different port can be specfied for this via:
-rmiRegistryPortSo, as an example, a broker can be started via:
imqbrokerd -startRmiRegistry -rmiRegistryPort 1098A run of 'imqcmd list jmx will now show something like:
% imqcmd list jmx -u admin -pw admin Listing JMX Connectors on the broker specified by: ------------------------- Host Primary Port ------------------------- localhost 7676 Name Active URL jmxrmi true service:jmx:rmi://yourhost/jndi/rmi://yourhost:1098/yourhost/7676/jmxrmi ssljmxrmi false Successfully listed JMX Connectors.The relevant URL is now:
service:jmx:rmi://yourhost/jndi/rmi://yourhost:1098/yourhost/7676/jmxrmiwhich can be used across broker restarts. This URL no longer contains a serialized stub but points to its location (in a RMI registry that is started by the broker).
service:jmx:rmi://yourhost/jndi/rmi://yourhost:1098/yourhost/7676/jmxrmi
Note that the host name 'yourhost' appears 3 times:
While the hostname in (1) and (2) above can be substituted with "localhost" (if it is the localhost), the hostname in (3) cannot be changed - the string that is seen here is a named location in the RMI registry that has nothing to do with the physical network host or IP.
Q: How do I view MBeans exposed as part of MQ's JMX API in jconsole ?
A: First you need to connect to the broker using jconsole. This is described in a separate FAQ entry: How do I connect to the broker using jconsole ?
Once jconsole is up and running and connected to the broker, select/view the MBeans tab. This tab will list the MBeans in the broker in a hierarchical list view, grouped according to domains. The MQ MBeans are in the domain
com.sun.messaging.jms.serverExpand this node. You will see a collection of other nodes. This list hierarchy is based on the ObjectName of the MQ MBeans. For example, the Object Name of the Destination Monitor MBean of the queue "SimpleQueue" is
com.sun.messaging.jms.server:type=Destination,subtype=Monitor,desttype=q,name="SimpleQueue"The name above is of the form:
domain:key1=value1,key2=value2,...The list nodes in jconsole are named after the values of the keys in the Object Name of the MBeans.
So to get to this MBean, the following nodes in the MBeans tab need to be expanded:
and clicking or expanding the leaf node "SimpleQueue" will show you information on this MBean as shown below.
![]() |
Q: How do I start up an MQ broker so that jconsole can connect to it through a firewall ?
A: It is useful to know the ports that are used in making a JMX connection especially if the broker is sitting behind a firewall. In this case, if a monitoring client (for example, jconsole) is outside the firewall and needs to connect to the broker:
The ports that are relevant for making a JMX connection to the broker are listed in the table below:
| Port | Default value | Description |
|---|---|---|
| RMI Registry Port | 1099 | This is the port used by the RMI Registry. As described in the FAQ entry How do I connect to the broker using jconsole ? the broker can be started with the options -startRmiRegistry and -rmiRegistryPort. If this is done, the JMX connection process will involve traffic on this port. The client will first connect to the RMIRegistry to obtain the RMI Connector stub which it will then use to create the actual JMX connection. |
| Port used by RMI Connector | None. This is dynamically allocated. | This is the port that is actually used by the RMI Connector. This is set via the MQ broker property imq.jmx.connector.connector_name.port The default connector name is 'jmxrmi', so the property that would be used here is imq.jmx.connector.jmxrmi.port. This property can be set in the broker's config.properties file or specified on the command line when starting up the broker using the -D option. If this property is not specified, the port used will be allocated dynamically. |
imqbrokerd -startRmiRegistry -rmiRegistryPort 1098 -Dimq.jmx.connector.jmxrmi.port=5656The JMX URL that is seen in the output of 'imqcmd list jmx' will contain the port numbers specified. For example:
% imqcmd list jmx Listing JMX Connectors on the broker specified by: ------------------------- Host Primary Port ------------------------- localhost 7676 Name Active URL jmxrmi true service:jmx:rmi://yourhost:5656/jndi/rmi://yourhost:1098/yourhost/7676/jmxrmi ssljmxrmi false Successfully listed JMX Connectors.
After starting the broker as above, the firewall needs to allow traffic on ports 1098 and 5656 for JMX clients. Note that the firewall may need to also allow traffic on additional ports - for JMS traffic.
If the broker is not using an RMI Registry, the port used by the RMI Connector can still be specified with the imq.jmx.connector.jmxrmi.port property as follows:
imqbrokerd -Dimq.jmx.connector.jmxrmi.port=5656
In this case, the firewall needs to only allow traffic on port 5656 (in addition to other ports used by jms traffic).