3 Replies Latest reply on Mar 3, 2005 12:27 AM by dimitris

    When is ServiceMBeanSupport.server property set?

    ehogberg

      Writing a MBean, extending ServiceMBeanSupport, that will be invoking methods on other MBean. Problem I'm encountering is that the server property never seems to be populated by the app server. No matter what point of the lifecycle, the server property evaluates to null. Same issue with this.getServer() as well.

      Do I need to specify some magic in the jboss-service.xml mbean declaration to populate this? Or am I just misunderstanding what this attribute is and what it should be used for?

      Using JBoss 4.0.0. Have noticed this on both Win XP and Darwin (OS X), so I suspect the issue is pilot error, rather than a platform bug. :)

      Thanks in advance for pointers,

      -E-

        • 1. Re: When is ServiceMBeanSupport.server property set?
          dimitris

          Have you overriden by accident (or intensionally) preRegister()?

          This is where this.server is set:

           ...
           public ObjectName preRegister(MBeanServer server, ObjectName name)
           throws Exception
           {
           this.server = server;
          
           serviceName = getObjectName(server, name);
          
           return serviceName;
           }
           ...
          


          • 2. Re: When is ServiceMBeanSupport.server property set?
            ehogberg

            Dmitri:

            No, I had not overridden any of the *register() methods. After I read your post, I tried an override of preRegister() that does nothing but call super.preRegister() and then output a log message. Interesting thing--preRegister() is not getting called. So that would certainly explain why this.server is always null...

            I'm suspecting that I'm not configuring something properly. The mbean is deployed as a .sar containing a jboss-service.xml configurator. Shouldn't this automatically self-register and start upon deployment? If so, then I'm really confused about why preRegister() never gets called. If not, then I'm just confused about how services should be set up. Either way, your thoughts would be appreciated.

            TIA,

            -E-

            • 3. Re: When is ServiceMBeanSupport.server property set?
              dimitris

              show your META-INF/jboss-service.xml