4 Replies Latest reply on Dec 8, 2010 1:08 PM by andrea salvadore

    JBoss HornetQ Cluster not distributing messages

    Andrew Rampulla Newbie

      I am new to this, but was trying to configure HornetQ (2.1.2.Final) in a clustered environment.  My goal is to have 2 servers running JBossAS5 + HornetQ.  I have everything updated but when I send messages to the "testQueue", they are only being received by the MDB on the server they were posted from.  I am reasonably certain that the 2 servers know they are part of a cluster because I see log lines about "Connecting bridge...".  I was expecting in this configuration to see the MDB on each server alternate receipt of the messages.  I've attached my configurations from jboss_home/server/default/deploy/hornetq.sar/ in the hopes that someone can tell me what I'm doing wrong.

       

      A another piece of information (not sure if it is relevant):

      1. The JMS sender is a Stateless session bean with the following member variables

          @Resource(mappedName="queue/testQueue")

          private Queue queue;     @Resource(mappedName="ConnectionFactory")
          ConnectionFactory cf;

       

       

      Thanks

        • 1. Re: JBoss HornetQ Cluster not distributing messages
          Andrew Rampulla Newbie

          I've gotten a little closer.  Using thread http://community.jboss.org/thread/146422 I discovered that the connector used in node must have a unique IP address and that using value="${jboss.bind.address:localhost}" when I run.sh -b 0.0.0.0 isn't binding to all the adapters properly.  This was determined by examining the ClusterConnection via JMX and seeing the IP address it was using was 127.0.0.1.

           

          Now my next problem appears to be that when I startup I have a simple testQueue defined in hornetq-jms.xml

          <queue name="TestQueue">
                <entry name="/queue/testQueue"/>
             </queue>

           

          But after I deploy my JMS sender, I see two queues in the JMX console.

          I'm guessing that somehow my use of @Resource(mappedName="queue/testQueue") isn't working.  It is also worth noting that when I deploy my JMS sender I see the following warning in the log

          08:03:43,500 WARNING [JMSServerManagerImpl] Binding for /queue/testQueue already exists

           

          Does anyone know why this is creating a second queue (and if dynamically created queues are supposed to participate in the cluster or are supposed to be local)?

          • 2. Re: JBoss HornetQ Cluster not distributing messages
            Andrew Rampulla Newbie

            I think I've solved all of my problems.  I accidentalyl had a local hornetq-jms.xml in my JMS sender project and it used a different case for "testQueue".

             

            Maybe someone can let me know if the following should be logged as bugs or I'm just missing something:

            1. in hornetq-configuration.xml when I create a connector using my address explicitly the cluster is created properly, but when I use value="${jboss.bind.address:localhost}" and start jboss with run.sh -b 0.0.0.0 it seems like the connector is created with 127.0.0.1.  I'm assuming this is incorrect because then the other servers in the cluster are not connecting to it properly.  If this is a bug, I'll be happy to file a bug report, but I wasn't sure if I was just missing something.

             

            2. When my project is deployed with a locally defined hornetq-jms file in my JMS sender project, the queue defined in that file is created as local to the server and does not participate in the cluster.  Is this the correct behavior?

             

            Thanks

            • 3. Re: JBoss HornetQ Cluster not distributing messages
              andrea salvadore Newbie

              Hi Andrew, did you figure out your problem?

              I have an issue that might be related not sure. I've been looking around the forums but nothing.

              I have hornetQ deployed inside my jboss 5.1.0 GA. The server is started with -b 0.0.0.0 option and when I run the client locally it connects and receives the messages no problem but

              when I run the same client from another machine i get this exception

               

               

              javax.jms.JMSException: Unable to connect to server using configuration org-hornetq-core-remoting-impl-netty-NettyConnectorFactory?port=5445&host=0-0-0-0
              at org.hornetq.core.client.impl.FailoverManagerImpl.createSession(FailoverManagerImpl.java:375)
              at org.hornetq.core.client.impl.ClientSessionFactoryImpl.createSessionInternal(ClientSessionFactoryImpl.java:1123)
              at org.hornetq.core.client.impl.ClientSessionFactoryImpl.createSession(ClientSessionFactoryImpl.java:849)
              at org.hornetq.jms.client.HornetQConnection.authorize(HornetQConnection.java:565)
              at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:624)
              at org.hornetq.jms.client.HornetQConnectionFactory.createConnection(HornetQConnectionFactory.java:116)
              at org.hornetq.jms.client.HornetQConnectionFactory.createConnection(HornetQConnectionFactory.java:111)
              at org.springframework.jms.connection.SingleConnectionFactory.doCreateConnection(SingleConnectionFactory.java:342)
              at org.springframework.jms.connection.SingleConnectionFactory.initConnection(SingleConnectionFactory.java:288)
              at org.springframework.jms.connection.SingleConnectionFactory.createConnection(SingleConnectionFactory.java:225)
              javax.jms.JMSException: Unable to connect to server using configuration org-hornetq-core-remoting-impl-netty-NettyConnectorFactory?port=5445&host=0-0-0-0
               at org.hornetq.core.client.impl.FailoverManagerImpl.createSession(FailoverManagerImpl.java:375)
               at org.hornetq.core.client.impl.ClientSessionFactoryImpl.createSessionInternal(ClientSessionFactoryImpl.java:1123)
               at org.hornetq.core.client.impl.ClientSessionFactoryImpl.createSession(ClientSessionFactoryImpl.java:849)
               at org.hornetq.jms.client.HornetQConnection.authorize(HornetQConnection.java:565)
               at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:624)
               at org.hornetq.jms.client.HornetQConnectionFactory.createConnection(HornetQConnectionFactory.java:116)
               at org.hornetq.jms.client.HornetQConnectionFactory.createConnection(HornetQConnectionFactory.java:111)
               at org.springframework.jms.connection.SingleConnectionFactory.doCreateConnection(SingleConnectionFactory.java:342)
               at org.springframework.jms.connection.SingleConnectionFactory.initConnection(SingleConnectionFactory.java:288)
               at org.springframework.jms.connection.SingleConnectionFactory.createConnection(SingleConnectionFactory.java:225)
              

               

              • 4. Re: JBoss HornetQ Cluster not distributing messages
                andrea salvadore Newbie

                I found the answer I was looking for, I think i got confused by the connectors / acceptors configuration.

                 

                Reading from the documentation

                http://hornetq.sourceforge.net/docs/hornetq-2.0.0.GA/user-manual/en/html/configuring-transports.html

                you can bind your acceptors to multiple addresses but for your connectors

                 

                It's not valid to specify multiple addresses when specifying the host for a connector; a connector makes a connection to one specific address

                 

                which I guess make sense. So I've changed my hornetq-configuration.xml to use the hornetq.remoting.host variable

                 

                     <connector name="netty">
                         <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
                         <param key="host"  value="${hornetq.remoting.host:localhost}"/>
                         <param key="port"  value="${hornetq.remoting.netty.port:5445}"/>
                      </connector>
                
                      <connector name="netty-throughput">
                         <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
                         <param key="host"  value="${hornetq.remoting.host:localhost}"/>
                         <param key="port"  value="${hornetq.remoting.netty.batch.port:5455}"/>
                         <param key="batch-delay" value="50"/>
                      </connector>
                

                 

                and I'm passing it in my jboss run script as -Dhornetq.remoting.host=%COMPUTERNAME%

                 

                <connector name="netty">
                         <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
                         <param key="host"  value="${hornetq.remoting.host:localhost}"/>
                         <param key="port"  value="${hornetq.remoting.netty.port:5445}"/>
                      </connector>