Show TOC Start of Content Area

Procedure documentation Registering the MBean  Locate the document in its SAP Library structure

Procedure

At this step you create a Servlet, through which you will look up the MBeanServer and register your MBean. It is recommended to do this in the Servlet init() method, because it is invoked once at application startup. In this example this is done in the BankServlet.java Servlet:

       1.      Lookup the MBeanServer in the init() method:

InitialContext initCtx = new InitialContext();

MBeanServer mbs = (MBeanServer)initCtx.lookup("jmx");

 

       2.      Create an ObjectName using the ObjectNameFactory class from the JMX library:

ObjectName objectMBeanName = ObjectNameFactory.getNameForApplicationResourcePerNode("BankMBean", RuntimeProperties.get(RuntimeProperties.PROPERTY_APPLICATION), ObjectNameFactory.EMPTY_VALUE, ObjectNameFactory.EMPTY_VALUE);

 

 

       3.      Create an instance of the MBean class:

Bank myMBean = new Bank(transaction);

 

       4.      Register the MBean in the MBeanServer:

mbs.registerMBean(myMBean, objectMBeanName);

 

 

End of Content Area