5 Replies Latest reply on Apr 30, 2002 9:09 AM by Hiram Chirino

    Remote clients unable to find jndi name.

    norm Newbie

      I've written a JMS client that works fine when I run it from the local machine. When I try to run it from a remote machine, I am unable to get a ConnectionFactory. Here is the code snippet that is failing:


      the NamingException.getMessage() produces - "jnp"
      real descriptive :).

      I also tried:


      the NamingException.getMessage() produces - "null"

      I'm thinking that I must have something missing in my jboss.jcml

      Any help would be greatly appreciated.

        • 1. Re: Remote clients unable to find jndi name.
          Cathy Zhang Newbie

          What version of JBoss are you using? Try using "ConnectionFactory" as the JNDI look up string and see if it solves your problem. eg:
          // Get the connection factory
          TopicConnectionFactory topicFactory =


          • 2. Re: Remote clients unable to find jndi name.
            norm Newbie

            Upon further invetigation, I see that I am getting a CommunicationException.

            javax.naming.CommunicationException [Root exception is java.rmi.ConnectException: Connection refused to host: localhost; nested exception is: java.net.ConnectException: Connection refused: connect]

            For some reason its trying to go to the localhost. I'm sure the context properties are correct.

            prop.put(Context.PROVIDER_URL, "jnp://");

            jndiContext=new InitialContext(prop);


            • 3. Re: Remote clients unable to find jndi name.
              Cathy Zhang Newbie

              Do you have to use "jnp://" setting? Can you just use
              prop.put(Context.PROVIDER_URL, "");
              I assume that you are writing a plain JMS client, not a bean that sends out messages through your local container to a topic running on a remote machine.

              • 4. Re: Remote clients unable to find jndi name.
                Enrique Comba Newbie

                I have this problem too. I don´t think the solution is putting the ip address of the machine you want to access, as we face the same problem using the ip or the resolved name.... :(

                • 5. Re: Remote clients unable to find jndi name.
                  Hiram Chirino Expert

                  You can bypass JNDI if you need to:

                  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();

                  ---- OR -----

                  Properties props = new Properties();
                  props.setProperty(UILServerILFactory.SERVER_IL_FACTORY_KEY, UILServerILFactory.SERVER_IL_FACTORY);
                  props.setProperty(UILServerILFactory.CLIENT_IL_SERVICE_KEY, UILServerILFactory.CLIENT_IL_SERVICE);
                  props.setProperty(UILServerILFactory.PING_PERIOD_KEY, "1000");
                  props.setProperty(UILServerILFactory.UIL_ADDRESS_KEY, "localhost");
                  props.setProperty(UILServerILFactory.UIL_PORT_KEY, "8091");

                  QueueConnectionFactory cf = new SpyConnectionFactory(props);