2 Replies Latest reply on Nov 8, 2002 5:45 PM by juha

    MBean and webApp

    kundapur

      Hello,

      This is the first time I am using JMX (and JBoss) and I might be missing something obvious. I looked at the 'Getting started' doc, the 'JBoss Admin' doc, and the forums but I could not find an answer.

      Here's the problem I am facing on Jboss v3.04 + Tomcat.

      - Let's say I deploy 'myWebApp.war' folder in the default/deploy.

      - The Hello.class and HelloMBean.class (ref. JMX book) are in myWebApp.war/WEB-INF/lib/myMbean.jar.

      - The user-service.xml contains



      The http://localhost:8080/jmx-console shows the 'user' domain and the mBean works as intended.

      It seems unclean to have the JBoss file user-service.xml refer to a jar and mbean in the webApp. My question is whether there is some way 'myWebApp.war' can declare Hello and HelloMBean to the JBoss MBean Server so that the Server can automatically register the HelloMBean, when the webApp is deployed. The web.xml and jboss-web.xml do not allow elements.

      Do I need to use a startupClass to register HelloMBean?

      If some way is possible, then will http://localhost:8080/jmx-console continue to display myMBean?

      Thanks,
      Niranjan

        • 1. Re: MBean and webApp
          kundapur

          After some more investigation, I discovered the SAR. I put myWebApp.war and META-INF folders inside mySAR.sar. The META-INF contains a jboss-service.xml, which looks like this:





          Now, I can take out the similar XML in the default/deploy/user-service.xml. However, I will appreciate very much if someone confirms that I am meeting my goals the "right" way.

          Thanks,
          Niranjan

          • 2. Re: MBean and webApp

            yes SAR is the packaging you want to use when your deployment unit includes mbeans.