!--a11y-->
Acquiring a Reference to the MBean
Server 
In order to register its resource MBean(s) an application has to acquire a reference to the MBean server. This is done using the following code:
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.
Keep
in mind that for the above code to work properly, you need to add a reference
from the application to the JMX library. This is done in the
application-j2ee-engine.xml
situated in the /META-INF folder of the EAR. There
you need to add the following code:
<reference reference-type="weak"> <reference-target target-type="library"> tc~jmx </reference-target> </reference> |
The next step is Building ObjectName(s) for the Resource MBean(s)
