Entering content frame

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

Procedure

As the next step, you need to create a Servlet where you look up the MBeanServer and register your MBean. It is a good idea to do this in the Servlet init() method, because it is invoked once at application startup. We do this in the BankServlet.java:

       1.      In the init() method, lookup the MBeanServer:

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);

 

The final step is to assign administrator permissions

 

Leaving content frame