2 Replies Latest reply on Aug 8, 2012 9:03 AM by jmesnil

    Remote hornetq cluster cannot be connected using discovery group.

    ther25

      Hello,

       

      I have set up a hornetq cluster (live-backup) using static connectors which look in the following way:

       

                      

                       <connector name="node1">
                          <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
                          <param key="host" value="valid_ip"/>
                          <param key="port" value="5445"/>
                        </connector>
      

       

      Connection factories on the remote client are defined as follows:

       

                          <pooled-connection-factory name="hornetq-ra">
                              <transaction mode="xa"/>
                              <connectors>
                                  <connector-ref connector-name="node1"/>
                                  <connector-ref connector-name="node2"/>
                                  ...
                              </connectors>
                              <entries>
                                  <entry name="java:/JmsXA"/>
                              </entries>
                          </pooled-connection-factory>
      

       

      Remote clients are connecting correctly to cluster and are able to recognize live server failure.

       

      I have then added broadcast group to members of the hornetq cluster:

       

       

                      <broadcast-groups>
                          <broadcast-group name="hornetq-bgroup">
                              <group-address>231.8.8.8</group-address>
                              <group-port>9876</group-port>
                              <broadcast-period>5000</broadcast-period>
                              <connector-ref>node1</connector-ref>
                              <connector-ref>node2</connector-ref>
                              ...
                          </broadcast-group>
                      </broadcast-groups>
      

       

      And then checked with tcpdump on the remote client to make sure UDP broadcast is happenning (and sent by live host).

       

      Afterwards I modified configuration on the remote client:

       

                      <discovery-groups>
                          <discovery-group name="hornetq-bgroup">
                              <group-address>231.8.8.8</group-address>
                              <group-port>9876</group-port>
                              <refresh-timeout>10000</refresh-timeout>
                          </discovery-group>
                      </discovery-groups>
      
                      <pooled-connection-factory name="hornetq-ra">
                              <discovery-group-ref discovery-group-name="hornetq-bgroup"/>
                              <transaction mode="xa"/>
                              <entries>
                                  <entry name="java:/JmsXA"/>
                              </entries>
                          </pooled-connection-factory>
      

       

      And clients are not longer able to connect, error message on the client looks as follows:

       

      11:49:10,181 WARN  [org.hornetq.jms.server.recovery.HornetQXAResourceWrapper] (Periodic Recovery) Can't connect to any hornetq server on recovery [XARecoveryConfig [hornetQConnectionFactory=HornetQConnectionFactory [serverLocator=ServerLocatorImpl [initialConnectors=[org-hornetq-core-remoting-impl-netty-NettyConnectorFactory?port=5445&host=xx-xx-xx-xx], discoveryGroupConfiguration=DiscoveryGroupConfiguration [discoveryInitialWaitTimeout=10000, groupAddress=231.8.8.8, groupPort=9876, localBindAddress=null, name=4890695c-bc4e-11e1-8a88-e89a8f13d910, refreshTimeout=10000]], clientID=null, dupsOKBatchSize=1048576, transactionBatchSize=1048576, readOnly=false], username=null, password=null]]

      11:49:10,183 WARN  [com.arjuna.ats.jta] (Periodic Recovery) ARJUNA016027: Local XARecoveryModule.xaRecovery got XA exception XAException.XAER_RMERR: javax.transaction.xa.XAException: Error trying to connect to any providers for xa recovery

                at org.hornetq.jms.server.recovery.HornetQXAResourceWrapper.getDelegate(HornetQXAResourceWrapper.java:275) [hornetq-jms-2.2.13.Final.jar:]

                at org.hornetq.jms.server.recovery.HornetQXAResourceWrapper.recover(HornetQXAResourceWrapper.java:77) [hornetq-jms-2.2.13.Final.jar:]

                at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.xaRecovery(XARecoveryModule.java:503) [jbossjts-4.16.2.Final.jar:]

                at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.resourceInitiatedRecoveryForRecoveryHelpers(XARecoveryModule.java:471) [jbossjts-4.16.2.Final.jar:]

                at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.bottomUpRecovery(XARecoveryModule.java:385) [jbossjts-4.16.2.Final.jar:]

                at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.periodicWorkSecondPass(XARecoveryModule.java:166) [jbossjts-4.16.2.Final.jar:]

                at com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery.doWorkInternal(PeriodicRecovery.java:789) [jbossjts-4.16.2.Final.jar:]

                at com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery.run(PeriodicRecovery.java:371) [jbossjts-4.16.2.Final.jar:]

      Caused by: HornetQException[errorCode=2 message=null]

                at org.hornetq.jms.server.recovery.HornetQXAResourceWrapper.connect(HornetQXAResourceWrapper.java:351) [hornetq-jms-2.2.13.Final.jar:]

                at org.hornetq.jms.server.recovery.HornetQXAResourceWrapper.getDelegate(HornetQXAResourceWrapper.java:251) [hornetq-jms-2.2.13.Final.jar:]

                ... 7 more

       

      Where boldened part is IP of a backup machine, not live. Live machine is not discovered at all.

       

      I checked jboss-as-messaging_1_1.xsd and there is not explicit way to define backup connector in broadcast group.

       

      However when I remove connector to backup machine in broadcast configuration live server is discovered by the remote client, but failover isn't happenning.

       

      Is it a bug or configuration issue?

        • 1. Re: Remote hornetq cluster cannot be connected using discovery group.
          hgupta

          Hi Yaro,

           

          Are you able to find a solution to this? I am seeing the same problem and really scratching my head for last several days.

           

          Thanks,

          Himanshu

          • 2. Re: Remote hornetq cluster cannot be connected using discovery group.
            jmesnil

            Yaro Sheng wrote:

             

            Hello,

             

            I have set up a hornetq cluster (live-backup) using static connectors which look in the following way:

                           

            Connection factories on the remote client are defined as follows:

             

                                <pooled-connection-factory name="hornetq-ra">
                                    <transaction mode="xa"/>
                                    <connectors>
                                        <connector-ref connector-name="node1"/>
                                        <connector-ref connector-name="node2"/>
                                        ...
                                    </connectors>
                                    <entries>
                                        <entry name="java:/JmsXA"/>
                                    </entries>
                                </pooled-connection-factory>

            Pooled connection factories are not meant to be used by *remote* clients. They are targeted for MDBs.

             

            When you changed their settings, it also affected another component that used them for XA resource recovery.

             

            Try to add a <connection-factory> instead. That should work:

             

            <connection-factory name="hornetq-ra">
               <discovery-group-ref discovery-group-name="hornetq-bgroup"/>
               <entries>
                 <entry name="java:jboss/exported/jms/ConnectionFactory"/>
               </entries>

              </connection-factory>

             

            and update your client to use the JNDI lookup "/jms/ConnectionFactory" (/JmsXA is for MDBs)