
InitialContext initialCtx = new InitialContext();
MBeanServer mbs = (MBeanServer)initialCtx.lookup("jmx");For more information about how to connect to the MBean Server, see Connecting to an MBeanServer .
This is done in the application-j2ee-engine.xml situated in the /META-INF folder of the EAR. In this xml you need to add the following code:
<reference reference-type="weak"> <reference-target target-type="library"> tc~jmx </reference-target> </reference>
Next, see Building ObjectName(s) for the Resource MBean(s)