4 Replies Latest reply on Aug 23, 2006 9:16 AM by neidisch

    Error trying to access remote Queue or Topic

    neidisch

      Hi there,
      first of all I am just a beginner with JBossMQ and JMS.

      I am succesfully using a MDB for sending messages to a queue. Both EJB MDN and queue are in the same server.
      Now, for other purposes I need to send some messages to the same queue since a little stand alone client.
      The following code works fine if executed on the server:

       Properties env = new Properties();
       env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
       env.put(Context.URL_PKG_PREFIXES, "org.jnp.interfaces");
       env.put(Context.PROVIDER_URL, "jorge:1199");
       env.put("java.naming.rmi.security.manager", "yes");
       QueueConnection connection = null;
       try {
       Context ctx = new InitialContext(env);
       Queue queue = (Queue)ctx.lookup("queue/OrderBriefQueue");
       QueueConnectionFactory queueFactory = (QueueConnectionFactory)ctx.lookup("UIL2ConnectionFactory");
       connection = queueFactory.createQueueConnection();
       QueueSession session = connection.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
       QueueSender sender = session.createSender(queue);
       MapMessage mMessage = session.createMapMessage();
       mMessage.setString("key", "value");
       sender.send(mMessage);
       String msgId = mMessage.getJMSMessageID();
       log.info("Message sent; ID " + msgId);
       } catch (NamingException e) {
       } catch (JMSException e) {
       } finally {
       connection.close();
       }
      


      But if executed in any other machine (with provesd access to the server), I get the exception:


      org.jboss.mq.SpyJMSException: Cannot authenticate user; - nested throwable: (java.net.ConnectException: Connection refused)
      at org.jboss.mq.Connection.authenticate(Connection.java:883)
      at org.jboss.mq.Connection.(Connection.java:238)
      at org.jboss.mq.SpyConnection.(SpyConnection.java:49)
      at org.jboss.mq.SpyConnectionFactory.createQueueConnection(SpyConnectionFactory.java:135)

      I know that I am a beginner, but I haven't found documentation explicit enough...
      What am I doing wrong?

      btw, I am using jboss 3.2.2.

      Regards and thanx in advance

      Neidisch