5 Replies Latest reply on Oct 29, 2003 7:34 AM by Alwyn Schoeman

    JMS Remote Client

    pep Newbie

      Hi,
      I'm trying to connect to JBoss JMS Service from a remote machine (with the guest user) and i've got the exception:
      org.jboss.mq.SpyJMSException: Cannot authenticate user; - nested throwable: (java.net.ConnectException: Connection refused: connect)
      at org.jboss.mq.Connection.authenticate(Connection.java:883)
      at org.jboss.mq.Connection.(Connection.java:238)
      at org.jboss.mq.SpyConnection.(SpyConnection.java:48)
      at org.jboss.mq.SpyConnectionFactory.createQueueConnection(SpyConnectionFactory.java:135)
      at ConexionJMSJboss.main(ConexionJMSJboss.java:47)
      Caused by: java.net.ConnectException: Connection refused: connect
      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.(Socket.java:291)
      at java.net.Socket.(Socket.java:147)
      at javax.net.DefaultSocketFactory.createSocket(DashoA6275)
      at org.jboss.mq.il.oil.OILServerIL.createConnection(OILServerIL.java:563)
      at org.jboss.mq.il.oil.OILServerIL.checkConnection(OILServerIL.java:507)
      at org.jboss.mq.il.oil.OILServerIL.authenticate(OILServerIL.java:289)
      at org.jboss.mq.Connection.authenticate(Connection.java:876)

      Any idea?
      Thank you.

        • 1. Re: JMS Remote Client
          Adrian Brock Master

          Post the code and changes you made to the config.

          Regards,
          Adrian

          • 2. Re: JMS Remote Client
            Adrian Brock Master

            Actually:

            > java.net.ConnectException: Connection refused: connect

            It cannot make a socket connection to the server.

            Regards,
            Adrian

            • 3. Re: JMS Remote Client
              arabin Novice

              I have the same problem with this code:

              public class PerformanceTesterSender implements Runnable
              {
              static InitialContext iniCtx = null;
              static QueueConnectionFactory qfact = null;
              //static QueueConnection qconn = null;

              String msg;
              //static CountDown done = new CountDown(1);
              public PerformanceTesterSender (String msg)
              {
              this.msg = msg;
              }

              public void run()
              {
              try
              {
              //Logging.debugInfoLog("Sending " + msg);
              sendRecvAsync(msg);
              }
              catch (Throwable ex)
              {
              synchronized (this)
              {
              //Logging.debugInfoLog(msg);
              ex.printStackTrace();
              }
              }
              }

              public void sendRecvAsync(String text)
              throws JMSException, NamingException
              {
              QueueSession session = null;
              Queue que = null;
              //Logging.debugInfoLog("Begin sendRecvAsync");
              // Setup the PTP connection, session
              synchronized (this)
              {
              if (iniCtx == null)
              iniCtx = new InitialContext();
              }

              que = (Queue) iniCtx.lookup("queue/testQueue");
              QueueConnection qconn = qfact.createQueueConnection();
              session = qconn.createQueueSession(false,
              QueueSession.AUTO_ACKNOWLEDGE);
              qconn.start();
              // Set the async listener
              QueueReceiver recv = session.createReceiver(que);
              //recv.setMessageListener(new ExListener());
              // Send a text msg
              QueueSender send = session.createSender(que);
              TextMessage tm = session.createTextMessage(text);
              send.send(tm);
              //Logging.debugInfoLog("sendRecvAsync, sent text="
              // + tm.getText());
              send.close();
              //Logging.debugInfoLog("End sendRecvAsync");
              qconn.stop();
              session.close();
              qconn.close();
              }


              public static void main(String args[]) throws Exception
              {
              iniCtx = new InitialContext();
              qfact = (QueueConnectionFactory) iniCtx.lookup("QueueConnectionFactory");
              //qconn = qfact.createQueueConnection();
              for (int ii=0; ii< 300; ii++)
              {
              String msg = "Text Message " + ii + " " + ServiceTimer.getFormattedTime();
              //Logging.debugInfoLog("Sending " + msg);
              PerformanceTesterSender client = new PerformanceTesterSender(msg);
              Thread thr = new Thread (new PerformanceTesterSender(msg));
              thr.start();
              }
              //Logging.debugInfoLog("Stop");
              //client.done.acquire();
              //done.acquire();
              //System.exit(0);
              }

              }

              The first 287 iterations are fine. On iteration 288 I have this exception.

              • 4. Re: JMS Remote Client
                Stephane Nicoll Master

                JMS Connections are not closed somehow. Have you checked what was happening at the client side. This might help.

                Regards,

                Stephane

                • 5. Re: JMS Remote Client
                  Alwyn Schoeman Newbie

                  I get the same exception to a remote server, but local works.

                  However it doesn't appear to be the problem where the server tries to connect back to client 0n 127.0.0.1 as tcpdump on lo shows nothing.