4 Replies Latest reply on Aug 29, 2003 6:17 AM by Jochen Kressin

    Redeployment of MBeans / .sar

    Jochen Kressin Newbie

      Hi,

      I use JBoss for quite a while but I am new to MBeans, so I started to play around with them.I created a very simple MBean (which does not extend a JBoss - Interface, just plain JavaBean) and a descriptor for it. I start JBoss and put everything in a *.sar - directory in the deploy directory by using an Ant - Task.
      It works fine and my MBean gets deployed. But, when I want to redeploy it, say by touching the jboss-service.xml, I get deployment exceptions:

      [java] 15:24:42,823 ERROR [MainDeployer] could not create deployment: file:/D:/jboss-3.2.2RC2/server/jdotest/deploy/jdo-service.sar/
      [java] org.jboss.deployment.DeploymentException: create operation failed for package file:/D:/jboss-3.2.2RC2/server/jdotest/deploy/jdo-service.sa
      r/; - nested throwable: (org.jboss.deployment.DeploymentException: Trying to install an already registered mbean: configuration:service=SimpleConfiguration)

      Isnt it possible to redeploy an MBean just like a Webapp? Do I need to somehow undeploy the MBean manually first? Or do I need to restart JBoss everytime I make changes to the MBean? This would be very annoying during development ...

      Here is the jboss-service.xml:



      someValue




      Thanks for your help!

      Jochen

        • 1. Re: Redeployment of MBeans / .sar
          Adrian Brock Master

          It says the mbean is already registered.

          Did you throw an Exception from preDeregister?

          Regards,
          Adrian

          • 2. Re: Redeployment of MBeans / .sar
            Jochen Kressin Newbie

            Hi,

            no, I did not throw any Exception, neither did I implement this method. My MBean is just a simple JavaBean, like the first example in the JBoss docs. Do I manually have to deregister the MBean, means react to some callback - method?

            What confuses me a little bit is this: When I remove my .sar - directory from the deploys directory, JBoss tells my in the console that the service is undeployed. I also do not see the MBean in the web-console anymore. Now, if i put the directory again in the deploy directory, I get the Exception that the MBean is already registered ... ?
            How can it be that the MBean stays registered, but I do not see it in web-console anymore?
            Maybe I am getting things wrong here, any hint would be appreciated.

            Thanks for your help!

            Jochen

            • 3. Re: Redeployment of MBeans / .sar
              Adrian Brock Master

              Post the log for the deployment and the -service.xml

              Regards,
              Adrian

              • 4. Re: Redeployment of MBeans / .sar
                Jochen Kressin Newbie

                Hi Adrian,

                I just found the error, and I must blame myself for my own stupidity ;) While playing with the service descriptor I copied one in my .sar/META-INF directory, while another version was still lying around in the deploy directory. So JBoss was absolutely right when complaining about the already regsitered MBean. Mea culpa.
                Sorry for this post, I could have found the error by myself. Thanks anyway for the replies!

                Jochen