2 Replies Latest reply on Nov 1, 2007 4:23 PM by Torsten Römer

    Management interface to webapps


      We have an existing J2EE 1.4 (servlets/JSP only) web application we'd like to add a management interface to, so application server administrators can manage our application via the JBoss JMX/Web Console (get status, alter configuration, get monitoring stats).

      I've been advised to create a new .sar file containing our JMX MBeans, but my question is how do we integrate this with our web application? How do I configure the classloading?

      Our new ear file is as follows:

      - main application (.war)
      - separate configuration application (.war)
      - new JMX MBeans (.sar)

      The two .war files need to run under isolated classloaders, to prevent clashes of code and libraries. How can I configure the .sar to have access to the main application's classes? The wiki seemed to suggest that classloading can only be specified at one level - in an ear file that would be in the jboss-app.xml - and lower levels - the .war's and .sar would have settings ignored.

      I don't really want to use Unified classloading - that seems to be all or nothing - because that also breaks certain parts of our application and prevents us from being able to deploy more than one copy of our applciation on a single app server instance.

      Am I right in thinking this is even possible in JMX? Is this a sledgehammer to crack a coconut?

        • 1. Re: Management interface to webapps

          Problem solved!

          By ignoring the advice to use a .sar file, I've added code to my main application that programmatically registers the MBean. And if using Spring this code can be replaced by some very simple configuration instead.

          // get the JBoss JMX MBean Server
          MBeanServer server = (MBeanServer) MBeanServerFactory.findMBeanServer(null).get(0);
          // register custom MBean
          MonitoringMBean bean = new Monitoring();
          server.registerMBean(bean, new ObjectName("test:name=Monitoring"));

          This is a much simpler solution, and needs no classloading configuration at all...

          • 2. Re: Management interface to webapps
            Torsten Römer Newbie

            Perfect, just what I was looking for!