1 Reply Latest reply on Nov 4, 2010 2:05 AM by KVMKrishna Reddy

    Problem in deploying regular MBean using HASingletonController

    KVMKrishna Reddy Newbie

      Hi,

      I am having problem in deploying MBean by using HASingletonController. MBean is bundled in sar which will be deployed through ear in DEPLOY directory. Now I clustered two instances of the same server.

       

      I want to make MBean has to be deployed only on master node (without making any changes to code/configurations). I followed the approach given in the JBoss 5 docs http://docs.jboss.org/jbossas/docs/Administration_And_Configuration_Guide/5/html_single/index.html#d0e7617

       

      I added a HASingletonController service as below

       

      <mbean code="org.jboss.ha.singleton.HASingletonController" name="com.adp.sbs:service=MYHASingletonController,target=MyService">
        <depends optional-attribute-name="ClusterPartition" proxy-type="attribute">jboss:partition=${jboss.partition.name:DefaultPartition},service=HAPartition</depends>
        <depends optional-attribute-name="TargetName">jboss:service=MyService</depends>
        <attribute name="TargetStartMethod">startService</attribute>
        <attribute name="TargetStopMethod">stopService</attribute>
      </mbean>

       

      I copied this file in FARM directory of two instances. Started both instances, but 'MYService' is running in both nodes.


      Can some one please help me on this.

       

      Thanks and Regards
      Murali Reddy

        • 1. Re: Problem in deploying regular MBean using HASingletonController
          KVMKrishna Reddy Newbie

          Hi,

           

          Finally I fixed the problem.

           

          The issue is with my current MBean implementation. MBean service is starting in start/startService method itself. This method will be invoked by JBoss deployer in life cycle process (first invoke create() then will start()).

           

          If we want to use the same service without any code changes, then needs to deploy in deploy-hasingleton directory which will be deployed (i.e create() and start() invocations) only on master node.

           

          Other option will be add dependency on 'BarrierController' (this will just call create() method. won't call start() method). But if any modules in application have dependency in this MBean service (in my case YES) those modules will fail. Because this MBean service is not started.

           

          Third option is move the 'service starting'  code out of start/startService methods and expose the 'service starting' as and MBean method which will be invoked by HASingletonController on Master node.

           

          Thanks and Regards

          Murali Reddy

          1 of 1 people found this helpful