2 Replies Latest reply on Oct 18, 2016 10:48 AM by Ibrahim Adali

    Failing to connect remotely

    Ibrahim Adali Newbie

      I'm having a problem when running my (java) client application from a machine other than the one where the hornetq server is running. Everything works fine when the application runs on the same machine. Port 5499 on the server seems to be open and looking at the output of tcpdump on the server I see some activity at the moment that the client attempts to establish the connection, however the hornetq sever log file (even set to DEBUG level logging) doesn't seem to register the fact that an attempt is being made to connect.

      Any help would be much appreciated. The error I get looks like this:

       

      16:35:25.279 [main] ERROR vip.server.e - Could not create Destination, ConnectionFactory: /SSLConnectionFactory / Destination: /topic/MarketDataSnap

      javax.naming.CommunicationException: Could not obtain connection to any of these urls: gcm-qps-rh1:5499 and discovery failed with error: javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out]

              at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1763) ~[jnp-client.jar:na]

              at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:693) ~[jnp-client.jar:na]

              at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:686) ~[jnp-client.jar:na]

              at javax.naming.InitialContext.lookup(InitialContext.java:411) ~[na:1.7.0_79]

              at vip.server.e.b(SourceFile:70) ~[vip.server.jar:na]

              at vip.server.e.e(SourceFile:125) ~[vip.server.jar:na]

              at vip.server.e.a(SourceFile:168) ~[vip.server.jar:na]

              at com.vivace.service.cache.SnapShotGen.a(SourceFile:351) [vip.server.jar:na]

              at com.vivace.service.cache.SnapShotGen.main(SourceFile:707) [vip.server.jar:na]

      Caused by: javax.naming.CommunicationException: Failed to connect to server gcm-qps-rh1/10.2.21.156:5499

              at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:335) ~[jnp-client.jar:na]

              at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1734) ~[jnp-client.jar:na]

              ... 8 common frames omitted

      Caused by: javax.naming.ServiceUnavailableException: Failed to connect to server gcm-qps-rh1/10.2.21.156:5499

              at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:305) ~[jnp-client.jar:na]

              ... 9 common frames omitted

      Caused by: java.net.ConnectException: Connection refused: connect

              at java.net.DualStackPlainSocketImpl.connect0(Native Method) ~[na:1.7.0_79]

              at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79) ~[na:1.7.0_79]

              at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339) ~[na:1.7.0_79]

              at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200) ~[na:1.7.0_79]

              at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182) ~[na:1.7.0_79]

              at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) ~[na:1.7.0_79]

              at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:1.7.0_79]

              at java.net.Socket.connect(Socket.java:579) ~[na:1.7.0_79]

              at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:97) ~[jnp-client.jar:na]

              at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:82) ~[jnp-client.jar:na]

              at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:301) ~[jnp-client.jar:na]

              ... 9 common frames omitted

       

       

      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

      After thinking about this for a day or so I think the most likely cause of this problem is that the hornetq server is listening only on the loopback interface (lo) and not on the external one (eth0). I'll have to read through the HQ docs to get to the solution but if anyone can give me a hand in the meantime, that would be great. If I am right, then the following segment of my hornet-beans.xml file will have to be modified. In particular the "localhost" entries will have to change. Trying to get up to speed on this...

       

         <bean name="JNDIServer" class="org.jnp.server.Main">

            <property name="namingInfo">

               <inject bean="Naming"/>

            </property>

            <property name="port">${jnp.port:5499}</property>

            <property name="bindAddress">${jnp.host:localhost}</property>

            <property name="rmiPort">${jnp.rmiPort:5498}</property>

            <property name="rmiBindAddress">${jnp.host:localhost}</property>

         </bean>

       

      Message was edited by: Ibrahim Adali