Leon Rosenberg [https://community.jboss.org/people/dvayanu] created the 
discussion

"Can not load com.sun.management.UnixOperatingSystemMXBean in JBoss 7 AS"

To view the discussion, visit: https://community.jboss.org/message/803519#803519

--------------------------------------------------------------
Hello,

I need to access the OperatingSystem MBean to read some values out of it, like 
open files. This works by 
ManagementFactory.getOperatingSystemMXBean();
However this method returns OperatingSystemMXBean which has limited 
functionality comparing to UnixOperatingSystemMXBean. So, when on Unix, I'm 
trying to load the class directly, and call its methods on the returned 
objects, like this (simplified):
OperatingSystemMXBean mxBean = ManagementFactory.getOperatingSystemMXBean();
Class clazz = Class.forName("com.sun.management.UnixOperatingSystemMXBean");
long openFiles = clazz.getMethod("getOpenFileDescriptorCount").invoke(mxBean);

This works in tomcat and other containers as well as in a standalone java 
application. However, it produces a ClassNotFound Exception in JBoss. I assue 
this is because UnixOperatingSystemMXBean is in customiz sun packages. Is there 
any workaround to get this class loaded?

regards
Leon
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/803519#803519]

Start a new discussion in Beginner's Corner at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075]

_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to