5 Replies Latest reply on Aug 4, 2011 5:30 PM by spandit_tudor.com

    HornetQ Stand-alone Clustered timeout

    sami_gh

      Hi All,

       

      I am trying to configure HornetQ stand-alone clustered mode but without any luck. I have two instances of HornetQ running at my localhost along with the client. The problem is that I get the following error when I try to connect:

       

       

      HornetQException[errorCode=3 message=Timed out waiting to receive initial broadcast from discovery group
      

       

       

      Please find below my files:

       

      hornetq-configuration.xml

       

       

      <configuration xmlns="urn:hornetq"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="urn:hornetq /schema/hornetq-configuration.xsd">
      
      
         <clustered>true</clustered>
      
      
         <!-- Connectors -->
         <connectors>
            <connector name="netty-connector">
               <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
               <param key="port" value="5447"/>
            </connector>
         </connectors>
      
         <!-- Acceptors -->
         <acceptors>
            <acceptor name="netty-acceptor">
               <factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
               <param key="port" value="5447"/>
            </acceptor>
         </acceptors>
      
         <!-- Clustering configuration -->
         <broadcast-groups>
            <broadcast-group name="My-Broadcast">
               <group-address>231.7.7.7</group-address>
               <group-port>9876</group-port>
               <broadcast-period>100</broadcast-period>
               <connector-ref connector-name="netty-connector"/>
            </broadcast-group>
         </broadcast-groups>
      
         <discovery-groups>
            <discovery-group name="My-Discovery">
               <group-address>231.7.7.7</group-address>
               <group-port>9876</group-port>
               <refresh-timeout>10000</refresh-timeout>
            </discovery-group>
         </discovery-groups>
      
      
         <!-- Other config -->
      
      
         <security-settings>
            <!--security for example queue-->
            <security-setting match="jms.queue.exampleQueue">
               <permission type="createDurableQueue" roles="guest"/>
               <permission type="deleteDurableQueue" roles="guest"/>
               <permission type="createNonDurableQueue" roles="guest"/>
               <permission type="deleteNonDurableQueue" roles="guest"/>
               <permission type="consume" roles="guest"/>
               <permission type="send" roles="guest"/>
            </security-setting>
         </security-settings>
      
      
      </configuration>
      
      

       

      hornetq-jms.xml

       

       

      <configuration xmlns="urn:hornetq"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="urn:hornetq /schema/hornetq-jms.xsd">
         <!--the connection factory used by the example-->
         <connection-factory name="ConnectionFactory">
            <discovery-group-ref discovery-group-name="My-Discovery"/>
            <entries>
               <entry name="ConnectionFactory"/>
            </entries>
         </connection-factory>
      
      
         <topic name="TEST_TOPIC">
               <entry name="/topic/TEST_TOPIC"/>
         </topic>
      
      </configuration>
      
      

       

      Code:

       

       

      final String groupAddress = "231.7.7.7";
      
      final int groupPort = 9876;
      
       HornetQConnectionFactory cf = new HornetQConnectionFactory(groupAddress, groupPort);
       cf.setDiscoveryInitialWaitTimeout(10000);
       Connection connection = cf.createConnection();
      
       session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); 
       connection.start();
      
      

       

      I am using windows XP and HornetQ 2.1.2.Final. I didn't have any troubles connecting to non-clustered HornetQ.

       

      I saw two other discussions with the same error, but their problems were related with remote clusters, so it didn't give me much help to discover the problem.

      Any help is highly appreciated,

       

      Thanks in Advance

       

      Sami

        • 1. HornetQ Stand-alone Clustered timeout
          clebert.suconic

          Did you look at the examples? Are they working fine?

           

          If not, you have networking issues on UDP

          • 2. HornetQ Stand-alone Clustered timeout
            sami_gh

            Thanks Clebert for the answer,

             

            The examples didn't work. After checking, it turned out that broadcasting is disabled. So I tried it on a server and worked correctly.

             

            Thanks again,

             

            Sami

            • 3. Re: HornetQ Stand-alone Clustered timeout
              hnctam

              Hi Sami,

               

              I have a question. How do you enable the broadcasting?

               

              Also, I am facing with an issue now.

              I used the same way to create the JMS connection:

               

              final String groupAddress = "231.7.7.7";

              final int groupPort = 9876;

              HornetQConnectionFactory cf = new HornetQConnectionFactory(groupAddress, groupPort);
              cf.setDiscoveryInitialWaitTimeout(10000);
              Connection connection = cf.createConnection();

              session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

               

              then I created a producer, but it failed to when finding defined queue on HornetQ

               

              Regards,

              Tam

              • 4. Re: HornetQ Stand-alone Clustered timeout
                hnctam

                Hi Clebert,

                 

                I 've bean successfully create connection and session to cluster HornetQ server (using discovery group and port)

                     final HornetQConnectionFactory factory = HornetQJMSClient.createConnectionFactory(discoveryGroup, discoveryPort);

                     connection = factory.createConnection();

                     connection.start();

                     session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

                 

                But it failed when I create a producer:

                    sender = session.createProducer(destination);

                 

                The sympton is if I run the JMS client in the HornetQ host, it's ok but from another host, it faied.

                • 5. Re: HornetQ Stand-alone Clustered timeout
                  spandit_tudor.com

                  Hi Sami,

                   

                  I too have the same issue.

                  How do you check if broadcasting is disabled?

                  Did you make any change to config files than what is posted here?

                   

                  Thanks,

                  Sanjeev