![]() |
|
Pramati Server supports deployment and registeration of custom application MBeans through an entry in the pramati-j2ee-server.xml. The MBean classes must be accessible from the application classloader; they should be present in the application itself or placed in the extension directory of the Server.
As the JMX specification does not specify standard interaction between application MBeans and a J2EE Server, this feature is implemented in proprietary way in Pramati Server. Each Pramati application has a custom deployment descriptor called pramati-j2ee-server.xml. This XML file is present at the top level of each archive.
Using the mbean tag available, given the MBean implementation class name and object name, the Server instantiates and registers the MBean when the application is deployed. Following is the DTD of the element mbean:
<!--Each MBean element should specify the fully qualified MBean implementation class name, and a valid ObjectName with which the instance of MBean should be registered--> <!ATTLIST mbean class NMTOKEN #REQUIRED> <ATTLIST mbean name CDATA #REQUIRED> <If the archive has several sub-web archives, the web-module name in which the mbean classes are present has to be specified here.--> <ATTLIST mbean web-module-name CDATA #IMPLIED>Using this element, the deployer can specify which MBean implementation needs to be instantiated and registered with the Server's MBean Server when the application gets deployed. The Server unregisters this MBean whenever the application is undeployed.
Note: The Server takes control of the MBean LifeCyle and registers the MBean as a part of deployment.
The application need not, and should not, try to make an explicit registerMBean() call.
pramati-j2ee-server.xml.pramati-j2ee-server.xml that intends to register an MBean class SimpleStandard with ObjectName PRAMATI:type=SimpleStandard. This MBean class is expected to be in WEB-INF/lib or WEB-INF/classes in case of a .war.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pramati-j2ee-server PUBLIC
'-//Pramati Technologies //DTD Pramati J2ee Server 5.0//EN'
'http://www.pramati.com/dtd/pramati-j2ee-server_5_0.dtd'>
<pramati-j2ee-server version="5.0">
<description>No Description</description>
<vhost-name>default</vhost-name>
<auto-start>TRUE<auto-start>
<web-module>
<name>mbeanTestWeb<name>
<module-name>mbeanTestWeb.war</module-name>
<web-module>
<mbeans>
<mbean class="SimpleStandard" name="PRAMATI:type=SimpleStandard"/>
<mbeans>
</pramati-j2ee-server>
Following is the directory structure of the .war file:
$ mbeanTestWeb.war
- index.jsp
- WEB-INF
- lib
- *SimpleStandard.jar*
- pramati-j2ee-server.xml
- WEB-INF
- web.xml
The SimpleStandard.jar contains the MBean classes.
| © Pramati Technologies 2007 | Runs on Pramati Server | Feedback | Legal |