Establish JMX management system for web applications (2)
Previous: "Create a JMX-based management system (1)" for your web application. Creating a MBean description file In the third code above, we can see that you must create MBean to MBean Server must first create MBeanInfo, MBean's setModelmbeanInfo () is used to set MBeanInfo into the MBEAN. In order to get the MBean information, the MBean is registered to MBeanServer, which is mentioned in the "Best Practice of Java Enterprise" published in O'Reilly, and the XML file is a very good option, and A XML description example is provided, so this article also recommends a method of managing web applications using a MBean description file. In fact, regardless of Tomcat4.x, or JBoss, the MBEAN is created by using the MBean description file. The following is provided with the MBean description file scheme in Tomcat4.x, and uses the scheme to describe the two database connection management mentioned above. MBean. Tomcat provides a way to read the description file, you can see the help documentation provided by Tomcat - how to use MBean Descriptor ("http://jakarta.apache.org/tomcat/tomcat-4.1-doc/mbeans-descriptor-howto .html ").
Description = "Test configure attribute" impact = "action" Returntype = "java.lang.string"> / / Register MBean to MBean Server MBeanServer Serv = getmbeanserver (); objectName oname = CreateObjectName (MBean); serv.registermbean (MBean, oname); 6. Write the client's client we have completed the registration of the server-side MBean, and how to make users can use these MBean management resources. Although HTMLADAPTERs are provided in JMX reference implementations, users can use MBean through the browser. But the interface is not so friendly, and the harsh customer will never be satisfied with this. Therefore, it is still necessary to write some simple access to the MBean page. How to access MBean through Java, you can refer to JMX information, which is very much. According to the above introduction, if you want to increase the management function or management system for web applications, JMX-based management framework is definitely a very sensible choice. At the time of being abducted, it is inevitable that there is a mistake, and I hope to know the taxis, I will give it to the mind, and I am grateful to the heart.