Workaround for Using JConsole with WLS 10gR3 JMX
By james.bayer on Mar 21, 2009
4-24-2009 Update – Please see the comments of this entry for a solution that only requires setting the classpath and does not require a custom RMI/IIOP proxy. Thanks to Kai and Mic for commenting with an easier solution. James
I came across a surprising interoperability issue the other day using JConsole to browse WLS 10gR3 JMX MBeans. Read on to see how to I got around it. One of my customers wanted to monitor some WLS services running in a cluster recently, so in doing a little research I decided to pull up JConsole to see what the JMX Beans looked like. Of course WLST works well for this, but I didn’t quite know where the MBean was located so I wanted something visual that I could navigate in a tree fashion without typing commands.
In order to bring up JConsole, you need to follow some basic steps in the documentation to enable RMI on the server you want to connect to: http://edocs.bea.com/wls/docs103/jmxinst/accesscust.html#wp1107229 Be sure to set the default RMI user and password and you will also need to restart the servers after you perform this configuration so it takes effect.
So normally you could just launch JConsole from the JDK’s bin directory and plug-in your connection info. In my case I am using JDK 6 from the WLS Example server which is running on port 7001. This is the URI I put into JConsole:
My RMI default user and password is “weblogic”
Well, to my surprise I got a JConsole Output window that kept scrolling with errors. Here is the beginning of the stack:
WARNING: "IOP00810257: (MARSHAL) Could not find class"
I looked around a bit on Google and found that since JDK 5 there has been a bug in the IIOP RMI stack in the JDK. Thankfully there is a work-around that involves creating a simple poor-man’s proxy. So I compiled and ran the RMIIIOPProxy.java file from that link (I removed the package name for brevity) and tried again to connect again while the proxy was running. This time it worked.
C:\temp>java RMIIIOPProxy 7011 weblogic.management.mbeanservers.runtime localhost 7001 weblogic.management.mbeanservers.runtime
Connection established with south server at: service:jmx:iiop:///jndi/iiop://localhost:7001/weblogic.management.mbeanservers.runtime
Proxy server listening at: service:jmx:rmi:///jndi/rmi://localhost:7011/weblogic.management.mbeanservers.runtime
Strike <Enter> to exit
So now there is a simple proxy that listens on port 7011 which then connects to port 7001 on my behalf and gets around the bug. I simply take the JMX URI from the proxy console output and plug that back in to JConsole, this time with a successful connection. Notice that this URI does not include IIOP. Now I get browse the MBeans, see the attributes, and execute operations like I expect. I also tried this with JDK 5’s JConsole and the same issue was present and solved by the work-around.