How do I access the MBeanServer or MBeanServerConnection from inside JBoss EAP
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 4.x
- 5.x
- 6.x
- 7.x
Issue
- How do I access the Content from docs.oracle.com is not included.MBeanServer or Content from docs.oracle.com is not included.MBeanServerConnection from inside JBoss EAP?
Resolution
-
EAP 4.x, 5.x
import org.jboss.mx.util.MBeanServerLocator; import javax.management.MBeanServerConnection; ... MBeanServerConnection server = MBeanServerLocator.locateJBoss();Note: The
MBeanServerLocatorclass is located in$JBOSS_HOME/client/jboss-j2se.jarin EAP 5.x, and in$JBOSS_HOME/client/jmx-client.jar(or$JBOSS_HOME/client/jbossall-client.jar) in EAP 4.x. -
EAP 6.x, 7.x
import java.lang.management.ManagementFactory; import javax.management.MBeanServer; ... MBeanServer server = ManagementFactory.getPlatformMBeanServer();
SBR
Components
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.