2 Replies Latest reply on Aug 30, 2007 10:41 AM by Ales Justin

    ServiceController unregistering

    Adrian Brock Master

      I was seeing the following warning in jboss-head

      14:25:15,021 WARN [AbstractKernelController] Error uninstalling from Instantiated: name=jboss.system:service=ServiceController state=Instantiated
      java.lang.IllegalArgumentException: Null MBeanServer
       at org.jboss.system.ServiceCreator.uninstall(ServiceCreator.java:303)
       at org.jboss.system.microcontainer.OnlyUnregisterAction.uninstallAction(OnlyUnregisterAction.java:45)
       at org.jboss.system.microcontainer.ServiceControllerContextAction.uninstall(ServiceControllerContextAction.java:90)
       at org.jboss.dependency.plugins.AbstractControllerContextActions.uninstall(AbstractControllerContextActions.java:58)
       at org.jboss.dependency.plugins.AbstractControllerContext.uninstall(AbstractControllerContext.java:311)
       at org.jboss.dependency.plugins.AbstractController.uninstall(AbstractController.java:1320)
       at org.jboss.dependency.plugins.AbstractController.uninstallContext(AbstractController.java:1009)
       at org.jboss.dependency.plugins.AbstractController.uninstallContext(AbstractController.java:936)
       at org.jboss.dependency.plugins.AbstractController.uninstall(AbstractController.java:463)
       at org.jboss.dependency.plugins.AbstractController.uninstall(AbstractController.java:426)
       at org.jboss.dependency.plugins.AbstractController.shutdown(AbstractController.java:168)
       at org.jboss.bootstrap.microcontainer.ServerImpl.doShutdown(ServerImpl.java:162)
       at org.jboss.bootstrap.AbstractServerImpl.shutdownServer(AbstractServerImpl.java:497)
       at org.jboss.bootstrap.AbstractServerImpl$ShutdownHook.run(AbstractServerImpl.java:778)
      


      This was due to the JMXKernel unregistering the ServiceController
      from the MBeanServer and then only later does the new MC shutdown
      spot that it was still registered with it.
      It tries to uninstall but gets an error because the ServiceController
      has lost its reference to the MBeanServer in the previous JMX uninstall.

      I've fixed the problem such that the ServiceController removes itself
      from both by doing an MC.uninstall() of itself during its shutdown.

      But this isn't a very clean solution.
      The (un)registrations are not symmetric.

      The fundamental problem comes from the self bootstrap where
      the ServiceController registers with itself and therefore it
      doesn't follow the usual pattern.

      Maybe there is a cleaner way to do this?

      In fact, the only reason the self bootstrap exists was to be able to
      place a dependency on the service controller.
      If the ServiceController were just a POJO with the @JMX
      annotation then we should have the required behaviour
      in jboss-head using the cross injection of POJOs into MBeans?