Search code examples
javajmxmbeans

How to enumerate all the MBeans for a JDK?


I am wondering whether I can enumerate all the MBeans getting from ManagementFactory.getRuntimeMXBean?


Solution

  • You can use the queryMBeans method on the MBeanServerConnection to list all the beans on a service (just pass null in for both parameters).

    To do that using ManagementFactory, call ManagementFactory.getPlatformMBeanServer().queryMBeans(null,null);