2 Replies Latest reply on Sep 22, 2005 8:38 AM by snoobabk

    Singleton MBean lookup fails after failover ( using singleto

    Derik Vercueil Newbie

      I'm running JBoss 4.0.2 under linux with JDK1.5.
      I've implemented a Singleton MBean which I am looking up using the SingletonRMI Adaptor as explained in the wiki:

      http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossHASingletonRemoteAccess

      This all works fine in my clustered environment up the point where I kill the master node on which my singletonMBeans are resident.

      I can see my SingletonMBean's *jumping* to the other node correctly except that when I try to look them up in HAJNDI again, the lookup throws a exception:

      "javax.naming.NameNotFoundException: jmx/invoker/SingletonRMIAdaptor"

      So assuming the SingletonRMIAdaptor...was not started up on this node when the master node died.

      Am I correct in deploying the "singleton-jmx-adapter-service.xml" in "<jboss_home>/server/all/deploy-hasingleton/" directory on both nodes in the cluster?

      I've looked at the JDNI tree using JNDIView in the JMX console and it *seems* that "jmx/invoker/SingletonRMIAdaptor" is there in the JNDI tree:

      Before failover on the master node:

      +- jmx (class: org.jnp.interfaces.NamingContext)
      | +- invoker (class: org.jnp.interfaces.NamingContext)
      | | +- SingletonRMIAdaptor (proxy: $Proxy37 implements interface org.jboss.jmx.adaptor.rmi.RMIAdaptor,interface org.jboss.jmx.adaptor.rmi.RMIAdaptorExt)
      | | +- RMIAdaptor (proxy: $Proxy38 implements interface org.jboss.jmx.adaptor.rmi.RMIAdaptor,interface org.jboss.jmx.adaptor.rmi.RMIAdaptorExt)
      | +- rmi (class: org.jnp.interfaces.NamingContext)
      | | +- RMIAdaptor[link -> jmx/invoker/RMIAdaptor] (class: javax.naming.LinkRef)


      After failover on the new master node:

      +- jmx (class: org.jnp.interfaces.NamingContext)
      | +- invoker (class: org.jnp.interfaces.NamingContext)
      | | +- SingletonRMIAdaptor (proxy: $Proxy205 implements interface org.jboss.jmx.adaptor.rmi.RMIAdaptor,interface org.jboss.jmx.adaptor.rmi.RMIAdaptorExt)
      | | +- RMIAdaptor (proxy: $Proxy37 implements interface org.jboss.jmx.adaptor.rmi.RMIAdaptor,interface org.jboss.jmx.adaptor.rmi.RMIAdaptorExt)
      | +- rmi (class: org.jnp.interfaces.NamingContext)
      | | +- RMIAdaptor[link -> jmx/invoker/RMIAdaptor] (class: javax.naming.LinkRef)

      Is there anything else I could try?

      Also - if I'm using the MBeanServerConnection class instead of the RMIAdaptor class for lookups in the case of the SingletonRMIAdaptor - does this make a difference?

        • 1. Re: Singleton MBean lookup fails after failover ( using sing
          Derik Vercueil Newbie

          To answer myself and to ask another question.
          It seems that my singleton MBean's should wait for the singletonRMIAdaptor to become available on another node before they can successfully call their startSingleton() methods.

          However, they normally call their startSingleton() methods up before the singletonRMIAdaptor starts up.

          Is there any way other than a dirty wait() statement to do this?

          A depends tag in jboss-service.xml...

          <?xml version="1.0" encoding="UTF-8"?>
          
          <server>
          
           <mbean code="com.mailtrack.app.promail.service.delivery.DeliveryService" name="promail:service=DeliveryService">
           <depends>promail:service=SchedulingService</depends>
           <depends>promail:service=SchedulingService-HASingletonController</depends>
           <depends>promail:service=NotificationSender</depends>
           <depends>promail:service=ConfigurationService</depends>
           </mbean>
          
           <!-- Make this MBean an singleton -->
           <mbean code="org.jboss.ha.singleton.HASingletonController"
           name="promail:service=DeliveryService-HASingletonController">
           <depends>jboss:service=DefaultPartition</depends>
           <depends>jboss.jmx:type=singletonadaptor,name=Invoker,protocol=jrmp,service=proxyFactory</depends>
           <depends>promail:service=DeliveryService</depends>
           <attribute name="PartitionName">DefaultPartition</attribute>
           <attribute name="TargetName">promail:service=DeliveryService</attribute>
           <attribute name="TargetStartMethod">startSingleton</attribute>
           <attribute name="TargetStopMethod">stopSingleton</attribute>
           <attribute name="TargetStopMethodArgument">true</attribute>
           </mbean>
          
          </server>
          


          or

          <?xml version="1.0" encoding="UTF-8"?>
          
          <server>
          
           <mbean code="com.mailtrack.app.promail.service.delivery.DeliveryService" name="promail:service=DeliveryService">
          <depends>jboss.jmx:type=singletonadaptor,name=Invoker,protocol=jrmp,service=proxyFactory</depends>
          <depends>promail:service=SchedulingService</depends>
          <depends>promail:service=SchedulingService-HASingletonController</depends>
           <depends>promail:service=NotificationSender</depends>
           <depends>promail:service=ConfigurationService</depends>
           </mbean>
          
           <!-- Make this MBean an singleton -->
           <mbean code="org.jboss.ha.singleton.HASingletonController"
           name="promail:service=DeliveryService-HASingletonController">
           <depends>jboss:service=DefaultPartition</depends>
           <depends>promail:service=DeliveryService</depends>
           <attribute name="PartitionName">DefaultPartition</attribute>
           <attribute name="TargetName">promail:service=DeliveryService</attribute>
           <attribute name="TargetStartMethod">startSingleton</attribute>
           <attribute name="TargetStopMethod">stopSingleton</attribute>
           <attribute name="TargetStopMethodArgument">true</attribute>
           </mbean>
          
          </server>
          

          ... won't work - since then the MBeans won't deploy at all ( or the HAsingleton controller won't deploy at all - depending on where we put the tag in the jboss-service.xml singleton mbean descriptor )



          • 2. Re: Singleton MBean lookup fails after failover ( using sing
            snoobabk Newbie

            Take a look at http://koolkat.hopto.org/blojsom/blog/default/development/?permalink=HA-singleton-on-JBoss.html

            which shows that you need to continue retrying the connection until the HA singleton starts up and the HAJNDI proxy actually connects.