0 Replies Latest reply on Nov 9, 2011 5:43 PM by Squidly Waters

    Jboss AS 6 hornetq timeout behind firewall

    Squidly Waters Newbie

      I've been stuck on this for a while and after looking through the docs, I have still had no luck so I hoping someone can point out what I am doing wrong.

      I tried looking through the hornetq documentation examplesm, reading searching this boards but couldn't figure out why it wouldn't connect.

       

       

      I'm trying to connect to a topic and message queue, behind a firewall on the Amazon AWS cloud.  Using jboss6 and hornetq.

       

       

      When I run the server bound to an vpn ip, it works fine:

      16:10:37 org.jnp.interfaces.TimedSocketFactory    DEBUG - createSocket, hostAddr: /<vpn-ip>, port: 1099, localAddr: null, localPort: 0, timeout: 0

       

      When I am trying to go through a NAT firewall the connection fails

      Nov 9, 2011 4:31:45 PM org.hornetq.core.logging.impl.JULLogDelegate error

      SEVERE: Failed to create netty connection

      java.net.SocketTimeoutException: connect timed out

                at java.net.PlainSocketImpl.socketConnect(Native Method)

                at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)

                at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)

                at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)

                at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)

                at java.net.Socket.connect(Socket.java:529)

                at org.jboss.netty.channel.socket.oio.OioClientSocketPipelineSink.connect(OioClientSocketPipelineSink.java:114)

                at org.jboss.netty.channel.socket.oio.OioClientSocketPipelineSink.eventSunk(OioClientSocketPipelineSink.java:74)

                at org.jboss.netty.channel.Channels.connect(Channels.java:541)

                at org.jboss.netty.channel.AbstractChannel.connect(AbstractChannel.java:217)

                at org.jboss.netty.bootstrap.ClientBootstrap.connect(ClientBootstrap.java:227)

                at org.jboss.netty.bootstrap.ClientBootstrap.connect(ClientBootstrap.java:188)

                at org.hornetq.core.remoting.impl.netty.NettyConnector.createConnection(NettyConnector.java:447)

                at org.hornetq.core.client.impl.FailoverManagerImpl.getConnection(FailoverManagerImpl.java:953)

                at org.hornetq.core.client.impl.FailoverManagerImpl.getConnectionWithRetry(FailoverManagerImpl.java:834)

                at org.hornetq.core.client.impl.FailoverManagerImpl.createSession(FailoverManagerImpl.java:342)

                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.hornetq.common.example.TestHttp.main(TestHttp.java:40)

      javax.jms.JMSException: Unable to connect to server using configuration org-hornetq-core-remoting-impl-netty-NettyConnectorFactory?port=5445&host=192-168-1-102

                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.hornetq.common.example.TestHttp.main(TestHttp.java:40)

      Caused by: HornetQException[errorCode=2 message=Unable to connect to server using configuration org-hornetq-core-remoting-impl-netty-NettyConnectorFactory?port=5445&host=192-168-1-102]

                ... 8 more

       

       

       

      These are the steps I have taken:

      I run the server with the following configuration, although I'm not sure if I should set useLocalHostname to false or true.  I tried both and neithe worked.

      run.sh -b <internal_ip> -Djava.rmi.server.hostname=<public_ip> -Djava.rmi.server.useLocalHostname=false

       

      I set up acceptors and connectors for listening via tcp on the default port of 5445 specified by the hornetq-configuration.xml attached

      I set up a NettyConnectionFactory pointing to the netty-tcp connector/acceptor pair I set up in the config.

       

       

      Originally, what I though the relevant ports were based on the config and the details specified here http://community.jboss.org/wiki/UsingJBossBehindAFirewall

      I put a jboss server on a the machine in a DMZ on a different network, in theory so none of the ports would be blocked and I could pull AWS out of the equation.

       

      I also tried setting up an http connector/acceptor pair and switch the NettyConnectionFactory to point to netty-http instead of netty-tcp but got the following:

      javax.jms.JMSException: Unable to connect to server using configuration org-hornetq-core-remoting-impl-netty-NettyConnectorFactory?port=8090&http-enabled=true

                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.hornetq.common.example.TestHttp.main(TestHttp.java:40)

      Caused by: HornetQException[errorCode=2 message=Unable to connect to server using configuration org-hornetq-core-remoting-impl-netty-NettyConnectorFactory?port=8090&http-enabled=true]

                ... 8 more

       

      I can tell that the client is resolving the queues, topics and connectionfactoru in the application server bu when it does a createConnection on the contextFactory, it fails.

       

       

      I also tried hardcoding the ip addresses in the connector/acceptor pair to the internal and external ip addresses as well as 0.0.0.0 and I still get timed out.

       

       

      What am I missing?

       

       

      Thanks in advance