2 Replies Latest reply on Feb 6, 2008 10:19 AM by Brian Stansberry

    ServiceControllerLifecycleCallback to unregister mbean?

    Brian Stansberry Master

      Should the ServiceControllerLifecycleCallback be unregistering mbeans in uninstall()? It's doing the registration in install(), but I'm not seeing any unregister call (unless it's buried in the KernelController.)

      I'm seeing problems with this in the EJB3 testsuite where I have an @JMX bean that gets deployed/undeployed in one test class and then deployed again in another.

      The initial undeploy goes fine:

      2007-12-11 12:19:33,855 DEBUG [org.jboss.system.microcontainer.jmx.ServiceControllerLifecycleCallback] Unregistering MBean jboss.cache:service=OptimisticEJB3EntityTreeCache
      2007-12-11 12:19:33,855 DEBUG [org.jboss.system.ServiceController] destroying service: jboss.cache:service=OptimisticEJB3EntityTreeCache
      2007-12-11 12:19:33,855 DEBUG [org.jboss.cache.CacheStatus] Ignoring call to stop() as current state is DESTROYED
      2007-12-11 12:19:33,855 DEBUG [org.jboss.cache.CacheStatus] Ignoring call to destroy() as current state is DESTROYED
      2007-12-11 12:19:33,861 DEBUG [org.jboss.deployers.structure.spi.helpers.AbstractDeploymentContext] Removed component OptimisticTestEJB3EntityCacheRuntimeConfig from vfsfile:/home/bes/dev/jboss/clean/trunk/ejb3/output/test-lib/optimistic-entity-cache-beans.xml
      2007-12-11 12:19:33,862 DEBUG [org.jboss.deployers.structure.spi.helpers.AbstractDeploymentContext] Removed component OptimisticTestEJB3EntityDefaultLRUConfig from vfsfile:/home/bes/dev/jboss/clean/trunk/ejb3/output/test-lib/optimistic-entity-cache-beans.xml


      But then a subsequent deploy of the same -beans.xml fails because the old registration is still there:

      2007-12-11 12:19:36,352 ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] Error installing to Configured: name=OptimisticTestEJB3EntityCache state=Configured
      java.lang.Exception: Error calling callback JMXAdvice for target context OptimisticTestEJB3EntityCache
       at org.jboss.dependency.plugins.AbstractLifecycleCallbackItem.install(AbstractLifecycleCallbackItem.java:86)
       ....
      Caused by: javax.management.InstanceAlreadyExistsException: jboss.cache:service=OptimisticEJB3EntityTreeCache already registered.
       at org.jboss.mx.server.registry.BasicMBeanRegistry.add(BasicMBeanRegistry.java:767)
       at org.jboss.mx.server.registry.BasicMBeanRegistry.registerMBean(BasicMBeanRegistry.java:236)
       ....
       at org.jboss.mx.server.MBeanServerImpl.registerMBean(MBeanServerImpl.java:1426)
       at org.jboss.mx.server.MBeanServerImpl.registerMBean(MBeanServerImpl.java:376)
       at org.jboss.system.microcontainer.jmx.ServiceControllerLifecycleCallback.install(ServiceControllerLifecycleCallback.java:90)
       ....
       at org.jboss.dependency.plugins.AbstractLifecycleCallbackItem.install(AbstractLifecycleCallbackItem.java:82)
       ... 76 more