6 Replies Latest reply on Feb 6, 2015 11:55 PM by Justin Bertram

    JMS connection factory errors when connecting to remote HornetQ server

    raylite3 Apprentice

      Hi, I have setup 2 Wildfly (8.2.0.Final) instances. Instance2 has a JMS connection factory pointing back to the Hornetq server in instance1. When I try to create a connection in instance2, I get an error with the following root cause. I am able to access/use the connection factory from a standalone Java client, so I figure I have something wrong in my configuration in instance2.

       

          17:32:00,134 INFO  [stdout] (ServerService Thread Pool -- 55) Caused by: HornetQConnectionTimedOutException[errorType=CONNECTION_TIMEDOUT message=HQ119013: Timed out waiting to receive cluster topology. Group:null]

          17:32:00,134 INFO  [stdout] (ServerService Thread Pool -- 55) at org.hornetq.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:946)

          17:32:00,135 INFO  [stdout] (ServerService Thread Pool -- 55) at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:669)

          17:32:00,135 INFO  [stdout] (ServerService Thread Pool -- 55) ... 62 more

       

      Here is a snippet of the standalone-full.xml from instance2.

       

          <subsystem xmlns="urn:jboss:domain:messaging:2.0">

                  <hornetq-server>

                      <security-enabled>false</security-enabled>

                      <connectors>                   

                          <connector name="remote-jms-connector">

                              <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>

                              <param key="host" value="localhost"/>

                              <param key="port" value="8080"/>

                          </connector>

                      </connectors>

       

      Is this correct way to define a connector to my instance1's server ?

       

      Thanks in advance !

        • 1. Re: JMS connection factory errors when connecting to remote HornetQ server
          Justin Bertram Master

          What kind of connection are you trying to create/use?  Are you making a normal JMS connection or are you using JCA?

           

          On instance1 do you have a Netty acceptor listening on port 8080?

          • 2. Re: JMS connection factory errors when connecting to remote HornetQ server
            raylite3 Apprentice

            I am using a normal JMS connection. I have a http-acceptor defined in instance1 as below.

             

                           <connectors>

                                <http-connector name="http-connector" socket-binding="http">

                                    <param key="http-upgrade-endpoint" value="http-acceptor"/>

                                </http-connector>

                                <in-vm-connector name="in-vm" server-id="0"/>

                           </connectors>

                           <acceptors>

                                <http-acceptor http-listener="default" name="http-acceptor"/>

                                <in-vm-acceptor name="in-vm" server-id="0"/>

                            </acceptors>

             

             

              Do I need to setup a netty acceptor (listening on a separate port 5445 for example) in order to connect up instance2 to instance1? I thought I could setup the http-acceptor only on instance1 so I don't need another port.

            • 3. Re: JMS connection factory errors when connecting to remote HornetQ server
              raylite3 Apprentice

              I am using a normal JMS connection. I have a http-acceptor defined in instance1 as below.

               

                             <connectors>

                                  <http-connector name="http-connector" socket-binding="http">

                                      <param key="http-upgrade-endpoint" value="http-acceptor"/>

                                  </http-connector>

                                  <in-vm-connector name="in-vm" server-id="0"/>

                             </connectors>

                             <acceptors>

                                  <http-acceptor http-listener="default" name="http-acceptor"/>

                                  <in-vm-acceptor name="in-vm" server-id="0"/>

                              </acceptors>

               

               

              Do I need to setup a netty acceptor (listening on a separate port 5445 for example) in order to connect up instance1 to instance2? I want to setup the http-acceptor only on instance1 so I don't need another port.


              Or can I use a different factory class instead of the NettyConnectorFactory in instance2 ?

              • 4. Re: JMS connection factory errors when connecting to remote HornetQ server
                Justin Bertram Master

                If you're using a normal JMS connection why do you need to administratively define a connector?  Typically in such a use-case you'd just look up a connection factory on instance1 using JNDI from your client on instance2.  Is that not what you're doing?  Please clarify.

                 

                In any event, a Netty connector can't connect to an HTTP acceptor.  The connector and acceptor types must match.

                • 5. Re: JMS connection factory errors when connecting to remote HornetQ server
                  raylite3 Apprentice

                  Thanks for the response. What I have been doing in AS7.x/EAP is define a connector that points from instance2 to instance1 and my code uses a local JNDI lookup. I thought I also needed to define my connection factories in this fashion to use MDBs in instance2 that receive messages from instance1.

                   

                                    <connection-factory name="RemoteConnectionFactory">

                                          <connectors>

                                              <connector-ref connector-name="remote-jms-connector"/>

                                          </connectors>

                                          <entries>

                                              <entry name="java:jboss/exported/jms/connectionFactory"/>

                                          </entries>

                                      </connection-factory>

                                      <pooled-connection-factory name="mdb-hornetq-ra">

                                          <transaction mode="xa"/>

                                          <connectors>

                                              <connector-ref connector-name="remote-jms-connector"/>

                                          </connectors>

                                          <entries>

                                              <entry name="java:/jms/PooledConnectionFactory"/>

                                              <entry name="java:jboss/DefaultJMSConnectionFactory"/>

                                          </entries>

                                      </pooled-connection-factory>

                   

                  instance1 is a dedicated JBoss/Wildfly instance for messaging. All other nodes connect to it to publish/receive and I have been configuring a Netty connector to do this. In Wildfly, is this not possible? And is remote JNDI lookup the recommended alternative?

                  Thanks!

                  • 6. Re: JMS connection factory errors when connecting to remote HornetQ server
                    Justin Bertram Master

                    It's certainly possible to define a local connector pointing to a remote server, configure a local connection factory with that connector, and then look up that connection factory from your local clients.  As I stated in my previous comment you just need to make sure your connectors and acceptors are matched up (e.g. use an http-connector to connect to an http-acceptor, use a netty-connector to connect to a netty-acceptor, etc.).  What you have currently configured just isn't compatible.

                     

                    That said, since you are running in an application server I would encourage you to avail yourself of its features and send your messages using a pooled-connection-factory (i.e. a JCA-based connection factory).  Performance will be much better and transaction management will be simpler as well.

                     

                    As far as MDBs go, you don't have to configure a remote connector via XML.  You can do all the configuration you need via activation configuration properties on the MDB itself if you like.