38.2. Configuration

In order to use the above ServletContextListener it must be configured in the web.xml of the web application that wants to register the MBeans. For example, the following lines added to web.xml will result in the registration of the MBeans specified in the application.mlet file under the WEB-INF directory. Multiple MLet files can be specified in a comma-separated list.

<context-param>
    <param-name>mletFiles</param-name>
    <param-value>application.mlet</param-value>
</context-param>

<listener>
   <listener-class>net.fiveprime.jmx.MBeanRegistrationListener
      </listener-class>
</listener>

An example MLet file to load an extension (detailed below) of the HibernateService MBean is:

<mlet code="ConfigurableHibernateService"
 name="HibernateService:Name=HibernateService"
 archive="mbeans.jar">
  <arg type="java.lang.String" value="hibernate.cfg.xml">
  <arg type="java.lang.String" value="hibernate/HibernateSessionFactory">
  <arg type="java.lang.String" value="DefaultDS">
</mlet>