2 Replies Latest reply on Jun 12, 2007 8:22 PM by nie feng

    Lookup Singleton MBean

    nie feng Newbie

      Hi all,

      I followed the configuration as specified on the OnJava.com (http://www.onjava.com/pub/a/onjava/2003/08/20/jboss_clustering.html) to configure a singleton MBean within the cluster env.

      However, i have problem on locating the singleton MBean. Below is my excerpt of my code on getting the mbean.

      String mbeanName = mbeanName = getServiceMBeanName();
       MBeanServer server = MBeanServerLocator.locate();
       AServiceMBean mbean = (AServiceMBean)MBeanProxyExt.create(AServiceMBean.class, mbeanName, server);
       System.out.println("is Master node: "+mbean.isMasterNode());
      


      The isMasterNode status will be true if the mbean is started as the singleton.

      On node 1, i tried to run the code and the above code stated it is a master node. On node 2, i tried the same thing, but i can't locate the singleton MBean cos the status i get is showng false.

      Seem like the MBean i am getting is from the Node2 MBeanServer instead of the Node1 mbean server.

      Is the way i perform the look up wrongly?

      Many thanks

        • 1. Re: Lookup Singleton MBean
          nie feng Newbie

          Ops, forgot to mention the jboss version i am running. The version is 4.05 GA.

          The following is the mbean configuration file

          <mbean code="test.ASingletonService"
           name="jboss.test:service=ASingleton">
           </mbean>
          
           <mbean code="org.jboss.ha.singleton.HASingletonController"
           name="jboss:service=HASingletonControllerMBean">
           <depends>jboss.test:service=ASingleton</depends>
           <depends>jboss.ha:service=HASingletonDeployer,type=Barrier</depends>
           <attribute name="TargetName">jboss.test:service=ASingleton</attribute>
           <attribute name="TargetStartMethod">startASingleton</attribute>
           <attribute name="TargetStopMethod">stopASingleton</attribute>
           </mbean>



          Thanks !

          • 2. Re: Lookup Singleton MBean
            nie feng Newbie

            Hi all,

            I have searched the answer in the jboss clustering forum, thanks