1 Reply Latest reply on Jul 16, 2004 12:53 PM by msquance

    JMS client behind a firewall reporting internal IP

    s2jcpete

      Hello all,
      I'm having an issue getting a client, which is behind a firewall, to connect to a server which isn't. The connection is made okay, but JBoss (3.2.1) is reporting the clients internal IP address and is timing out when trying to establish the "ConnectionReciever/Server"

      2004-07-08 19:19:43,554 ERROR [org.jboss.mq.il.oil.OILClientIL] Cannot connect to the ConnectionReceiver/Server
      java.net.NoRouteToHostException: No route to host
       at java.net.PlainSocketImpl.socketConnect(Native Method)
       at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
       at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
       at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
       at java.net.Socket.connect(Socket.java:426)
       at java.net.Socket.connect(Socket.java:376)
       at java.net.Socket.<init>(Socket.java:291)
       at java.net.Socket.<init>(Socket.java:147)
       at org.jboss.mq.il.oil.OILClientIL.createConnection(OILClientIL.java:175)
       at org.jboss.mq.il.oil.OILClientIL.checkSocket(OILClientIL.java:156)
       at org.jboss.mq.il.oil.OILClientIL.close(OILClientIL.java:72)
       at org.jboss.mq.server.JMSDestinationManager.connectionClosing(JMSDestinationManager.java:578)
       at org.jboss.mq.server.JMSServerInterceptorSupport.connectionClosing(JMSServerInterceptorSupport.java:112)
       at org.jboss.mq.security.ServerSecurityInterceptor.connectionClosing(ServerSecurityInterceptor.java:61)
       at org.jboss.mq.server.TracingInterceptor.connectionClosing(TracingInterceptor.java:158)
       at org.jboss.mq.server.JMSServerInvoker.connectionClosing(JMSServerInvoker.java:114)
       at org.jboss.mq.il.oil.OILServerILService$Client.run(OILServerILService.java:263)
       at java.lang.Thread.run(Thread.java:536)
      


      I'm a little at a loss as what to do here. Here is the sample code I'm trying to establish a connection with:
      InitialContext iniCtx = this.getContext();
       Object tmp = iniCtx.lookup("ConnectionFactory");
       TopicConnectionFactory tcf = (TopicConnectionFactory) tmp;
       conn = tcf.createTopicConnection();
       topic = (Topic) iniCtx.lookup("topic/Logs");
       session = conn.createTopicSession(false, TopicSession.AUTO_ACKNOWLEDGE);
       conn.start();

      and getting the context is:
      public InitialContext getContext() throws NamingException{
      
       Properties env = new Properties();
       env.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
       env.setProperty("java.naming.provider.url", "xxx.xxx.xxx.xxx:1099");
       env.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming");
       return new InitialContext(env);
      
       }
      


      This is just a sample that I am trying to get to run. The server throws its exception after
      session = conn.createTopicSession(false, TopicSession.AUTO_ACKNOWLEDGE);


      Any help would be greatly appreciated

      Thanks in advance,
      -Jay

        • 1. Re: JMS client behind a firewall reporting internal IP
          msquance

          I don't know about JMS in particular, but from my experience the JBoss server will report back to the client an invoker URL to use after the inital lookup.

          This URL is not necessarily the same host address that was used to connect. Depending on your configuration, it may be using the hostname in the URL and if your client can't resolve that host name, it won't work. I've also seen it return a different IP address than the one connected to (on a multi-interface machine) and again the client may not have a route to that IP interface.

          Take a look at the JBoss 3.2.1 docs - the section on Naming/JNDI and in particular the settings for UseHostName or InvokerURL for the http-invoker.sar/META-INF/jboss-service.xml

          Hope that helps.