How do you enable JMX in Websphere?

Following information is for Websphere 6.1 on Windows.

First of all, the magic URL to connect to the MBean server is:

service:jmx:iiop://<host>:<port>/jndi/JMXConnector

If you have a default Websphere installation, the JNDI port number will likely be 2809, 2810, … depending on how many servers there are installed on one system and the specific one you want to connect to. To be sure, when starting Websphere, check the logs, as it will dump a line like

0000000a RMIConnectorC A   ADMC0026I: The RMI Connector is available at port 2810

If you don’t get this line, open the Websphere admin console and go to

Application servers > server1 >
Administration Services > JMX
connectors

to see if you need to add or change the config.

Second important bit of information is that the following JAR is always needed when doing JMX with the server:

com.ibm.ws.admin.client_6.1.0.jar

You can find this JAR in the the runtimes directory of Websphere. Whatever you do, whether programmatically accessing MBeans on Websphere, or using JConsole, and so on, use the magic URL and always include this JAR.

For the remainder of this answer, assume that Websphere is installed in D:\prog\was61.

To run JConsole, type in the following:

D:\prog\was61\java\bin>jconsole -J-Djava.class.path=d:\prog\was61\java\lib\tools.jar;D:\prog\was61\runtimes\com.ibm.ws.admin.client_6.1.0.jar

Then go to the “Advanced” tab and type in the magic JMX URL. Press connect and you should see the MBeans appear.

Using a Sun JDK is an entirely different matter. You need one extra JAR that is in the lib of the IBM JDK but not Sun’s (ibmorb.jar), and maybe the following command may work for you:

C:\Program Files\Java\jdk1.5.0_11\bin>jconsole -J-Djava.class.path="c:\Program Files\Java\jdk1.5.0_11\lib\jconsole.jar";"c:\Program Files\Java\jdk1.5.0_11\lib\tools.jar";D:\prog\was61\runtimes\com.ibm.ws.admin.client_6.1.0.jar;D:\prog\was61\java\jre\lib\ibmorb.jar

I say maybe, because it didn’t work for me. I got a nice jndiUnavailCommErr error message, since it expected something on port 2809 while my Websphere installation is listening on 2810, although I correctly specified port 2810 in the JMX URL. But, if you adapt the paths to point to your Sun JDK, it might work for you. It’s the closest I ever got to connecting to Websphere using Sun’s JDK.

Final note: I tried a solution based on RMI, there is also a SOAP connector available but haven’t tried it.

As always with J2EE, Websphere and stuff: good luck, you’ll need it.

Leave a Comment