2 Replies Latest reply on Nov 18, 2002 11:26 AM by felix

    Cannot connect to the server for send message using JMS

    felix Newbie

      I'm making tests with JMS using JBoss-2.4.8

      I cannot connect with the server, that is running in another machine than the client.

      The error tell me than I connect to 127.0.0.1 and I have specified as property Context.PROVIDER_URL the IP of the
      server

      This is the error :

      Queue name is queue/testQueue
      JNDI lookup failed: javax.naming.CommunicationException [Root exception is java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is:
      java.net.ConnectException: Connection refused: connect]

      And this is the extract of the code:

      Properties env=new Properties();

      env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      env.put(Context.PROVIDER_URL, "19.19.19.19:1099"); //
      env.put(Context.URL_PKG_PREFIXES, "org.jnp.interfaces" );

      try {

      jndiContext = new InitialContext(env);
      } catch (NamingException e) {
      System.out.println("Could not create JNDI " +
      "context: " + e.toString());
      System.exit(1);
      }

      /*
      * Look up connection factory and queue. If either does
      * not exist, exit.
      */
      try {
      queueConnectionFactory = (QueueConnectionFactory)
      jndiContext.lookup("QueueConnectionFactory");
      queue = (Queue) jndiContext.lookup(queueName);
      } catch (NamingException e) {
      System.out.println("JNDI lookup failed: " +
      e.toString());
      System.exit(1);
      }

      Can anybody tell me what it's wrong?

      Thanks in advance