2 Replies Latest reply on Sep 13, 2005 8:17 PM by vlokesh

    servlet depends on MBean!

    vikas kumar Newbie

      Just playing around with jboss,axis.

      I created a servlet that makes use of a certain mbean.
      I want the mbean to be registered first and then the servlet class to be initialized.
      The Mbean is part of a different sar and the servlet in question is in a different war file.
      Can any one help me with this.
      Is there any way of doing this through web.xml??

      Thanks in advance for the help!

        • 1. Re: servlet depends on MBean!
          Venkata Rajesh Newbie

          Hi,

          To register the mBean you need to add the following lines to the default\conf\jBoss-service.xml

          This makes the jBoss while loading to recognize the mBean

          Following is a sample how to use it

          <mbean code="your mbean"
           name="your mBean name which you have given in the mbean java file">
           </mbean>


          for example

          <mbean code="com.jnu.temp.server.ServerExample"
           name="temp.server:alias=temp/server/ServerExample">
           </mbean>


          the name in the above code sample is the ObjectName you specify in your mBean
          Before that you make sure that your mbean follows the architecture or Jboss throws exception and will not start

          Hope this helps

          Thanks
          Venkat

          • 2. Re: servlet depends on MBean!
            vlokesh Newbie

            Package your servlet in a war file. Package your mbean in a SAR file. Create jboss-web.xml under WEB-INF folder and mention the SAR dependency in that file.

            Example
            ******

            jboss-web.xml under WEB-INF

            < jboss-web >
            < depends >someservice:mbeanName
            </jboss-web>

            Regards.

            Lokesh.