1 Reply Latest reply on Feb 20, 2013 10:37 PM by cinish

    How to override an mbean in JBoss?

    Albert Newton Newbie

      I am trying to override an mbean in jboss:


      (First mbean)

       

      <mbean code="org.jboss.jms.server.destination.QueueService" name="jboss.messaging.destination:service=Queue,name=MyQueue" xmbean-dd="xmdesc/Queue-xmbean.xml">

            <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>

            <depends>jboss.messaging:service=PostOffice</depends>    

         </mbean>

       

      The reason I am trying to override this mbean is because I need to specify paging properties for that queue as follows:

       

      (Second mbean)

       

      <mbean code="org.jboss.jms.server.destination.QueueService" name="jboss.messaging.destination:service=Queue,name=MyQueue" xmbean-dd="xmdesc/Queue-xmbean.xml">

            <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>

            <depends>jboss.messaging:service=PostOffice</depends>

            <attribute name="FullSize">100</attribute>

            <attribute name="PageSize">20</attribute>

            <attribute name="DownCacheSize">20</attribute>

         </mbean>


      The first mbean gets loaded when the server starts up (It is part of a SAR file which is located inside an EAR, so as the server starts up, it starts up the EAR which in turn loads the mbean from the SAR file).

       

      I am wanting to override the first bean with the second bean so that it will have the paging parameters set after startup. However, when I tried to put the second mbean in the jboss_instance/deploy/messaging/destinations-service.xml file, it gives me an error during startup when the jboss server tries to start the EAR as follows:

       

      'The mbean MyQueue is already registered'

       

      So what's happeining is that it  has already registered the mbean that I put in the destinations-service.xml file, but when it tries to start the server and sees that mbean in the SAR file in the EAR as well, it is erroring out.

      Does anyone know how I can fix this problem so that it is able to load just one mbean with the paging parameters (the second mbean?