getPlatformMBeanServer found wrong server
joc Apr 17, 2014 7:02 AMI recently had a problem with JBoss AS 7.4.0 and jmx lookusp, where a simple query to the MBean server fails to find something.
This was running on 64bit Java7 jdk1.7.0_25
The application started up ok, and I attempted to log in, then logincode hits a servlet that checks the http and https ports the server is using.
The lookup code was as follows, but didn't find anything.
mBeanServer = ManagementFactory.getPlatformMBeanServer(); query = new ObjectName("jboss.as:socket-binding-group=standard-sockets,socket-binding=http"); port = (Integer) mBeanServer.getAttribute(query, "boundPort");
As I was debugging at the time I hit this problem, I took a look into it. The mbeanserver the getplatformmbeanserver was returning was com.sun.jmx.mbeanserver.JmxMBeanServer , when looking at a working server this always appears to be org.jboss.as.jmx.PluggableMBeanServerImpl
Dumping out a list of everything in the mbeanserver showed that all our webservices were in there,
e.g jboss.ws:context=WebApp,endpoint=CalendarAccessService etc etc
but none of our other deployed items like ejb's, servlets
There were a variety of other jboss specific items,
e.g jboss.modules:type=ModuleLoader,name=LocalModuleLoader-2
and many runtime items
e.g java.lang:type=Memory
but there wasn't a single item in there starting with jboss.as:
It appears to be rather random, I have only had it happen once to me. Some other developers on my team have seen it too, and one of our overseas offices has seen it a few times now.
I'm a little stumped at how / why this might be happening and what I can do to protect against it. One the one time I caught it going wrong, I used findMbeanServer to list everything, but it only returned the one server, so iterating over all servers found doesn't appear to be an option. I cant think what else to try - or how to force the problem to be able to investigate it better, so all suggestions welcome !