6 Replies Latest reply on Oct 22, 2001 2:20 PM by Rafa Morant

    CommunicationException in jndi lookup()

    Rafa Morant Newbie

      Dreistein wrote:
      >in my localnetwork there is no problem to recive the jms messgae but over the internet i got always a timeout.

      My problem is the same, but the exception throws at the next line:
      QueueConnectionFactory queueFactory = (QueueConnectionFactory)_context.lookup(_queueConnectionFactory);

      because it is looking for a local IP (, but the router's Internet IP is other.

      javax.naming.CommunicationException. Root exception is java.rmi.ConnectIOExcept
      ion: Exception creating connection to:; nested exception is:
      java.net.NoRouteToHostException: Host unreachable: no further informatio
      java.net.NoRouteToHostException: Host unreachable: no further information
      at java.net.PlainSocketImpl.socketConnect(Native Method)
      at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
      at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:125)
      at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:112)
      at java.net.Socket.(Socket.java:269)
      at java.net.Socket.(Socket.java:98)
      at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirect
      at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMaster
      at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:497)
      at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:194
      at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:178)
      at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:87)
      at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:349)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:333)
      at javax.naming.InitialContext.lookup(InitialContext.java:354)
      at com.albasoft.dbsync.ExecControler.jmsConnect(ExecControler.java:120)
      at com.albasoft.dbsync.ExecControler.downloadMessages(ExecControler.java

      1. Find the remote server using Context.PROVIDER_URL enviroment property.
      2. gets the jndi InitialContext
      but try to find the server with his local IP.

      Is it possible to use the URL passed in the Context.PROVIDER_URL instead of the IP passed from de JNDI Server?

      How can i use JBossMQ throught a router?

      Greetings Rafa

        • 1. Re: CommunicationException in jndi lookup()
          Peter Antman Expert

          I think the only way you could do that now is by using the UIL version of the factories (see the manual).


          • 2. Re: CommunicationException in jndi lookup()
            Rafa Morant Newbie

            Already use UIL.

            _queueConnectionFactory = "UILConnectionFactory";
            _context = new InitialContext(props);
            QueueConnectionFactory queueFactory =(QueueConnectionFactory)_context.lookup(_queueConnectionFactory);
            _queueConnection = queueFactory.createQueueConnection();

            But i think that the problem is while Context.lookup(), that never returns the QueueConnectionFactory because don't find the local IP.

            ¿can i connect to JMS directly without JNDI?
            Then i should be use UIL and redirect the router port to the server UIL port.


            • 3. Re: CommunicationException in jndi lookup()
              Hiram Chirino Expert

              Some of the ground work has been laid so that you can do what you are requesting.

              It would require you to do a non-jms-portable call, but that's cause you would not be using JNDI.

              Basicly you would create the QueueConnectionFactory like this.

              Properties props = new Properties();
              props.set("address", "");
              props.set("other prop", "something");
              QueueConnectionFactory queueFactory = new SpyConnectionFactory(props);

              What is left to do is some small code changes and document the properties that need to be set for each different type of IL.


              • 4. Re: CommunicationException in jndi lookup()
                Hiram Chirino Expert

                I just finished implementing that feature and it's been commited to the CVS HEAD. So to do a connection to the JBossMQ server with out using JNDI to get the connection factory.. you would do:

                Properties props = new Properties();
                props.setProperty(OILServerILFactory.SERVER_IL_FACTORY_KEY, OILServerILFactory.SERVER_IL_FACTORY);
                props.setProperty(OILServerILFactory.CLIENT_IL_SERVICE_KEY, OILServerILFactory.CLIENT_IL_SERVICE);
                props.setProperty(OILServerILFactory.PING_PERIOD_KEY, "1000");
                props.setProperty(OILServerILFactory.OIL_ADDRESS_KEY, "localhost");
                props.setProperty(OILServerILFactory.OIL_PORT_KEY, "8090");

                QueueConnectionFactory cf = new SpyConnectionFactory(props);
                QueueConnection c = cf.createQueueConnection();

                • 5. Re: CommunicationException in jndi lookup()
                  Peter Antman Expert

                  Hiram, you simply rocks!


                  • 6. Re: CommunicationException in jndi lookup()
                    Rafa Morant Newbie

                    Hi Hiram!

                    I'm agree with you. You are "Cojonudo".

                    I have been rewriting my program and now the client can connect from Internet.
                    Today was a good day.

                    Thank you very much for your support.