2 Replies Latest reply on Apr 23, 2003 9:52 PM by minmin

    how to display JMS client

    minmin Newbie

      I'm testing a program of JMS,though I passed the deploy,the client file is always has errors such as :

      14:58:00,122 WARN [OILServerILService] Connection failure (1).
      java.net.SocketException: Connection reset by peer: JVM_recv in socket input str
      eam read
      at java.net.SocketInputStream.socketRead0(Native Method)
      at java.net.SocketInputStream.read(SocketInputStream.java:119)
      at java.io.BufferedInputStream.fill(BufferedInputStream.java:186)
      at java.io.BufferedInputStream.read(BufferedInputStream.java:204)
      at java.io.ObjectInputStream$PeekInputStream.peek(ObjectInputStream.java
      :2121)
      at java.io.ObjectInputStream$BlockDataInputStream.readBlockHeader(Object
      InputStream.java:2304)
      at java.io.ObjectInputStream$BlockDataInputStream.refill(ObjectInputStre
      am.java:2371)
      at java.io.ObjectInputStream$BlockDataInputStream.read(ObjectInputStream
      .java:2443)
      at java.io.ObjectInputStream$BlockDataInputStream.readByte(ObjectInputSt
      ream.java:2592)
      at java.io.ObjectInputStream.readByte(ObjectInputStream.java:840)
      at org.jboss.mq.il.oil.OILServerILService$Client.run(OILServerILService.
      java:205)
      at java.lang.Thread.run(Thread.java:539)
      For help!

        • 1. Re: how to display JMS client
          Adrian Brock Master

          This says the client closed the socket.
          Did it crash?

          Regards,
          Adrian

          • 2. Re: how to display JMS client
            minmin Newbie

            what is socket?I can't understand!
            when I run the client file (below):
            import javax.jms.*;
            import java.io.*;
            import java.net.*;
            import javax.naming.*;

            public class MsgListener {
            private static final String QUEUE_CONN_FACTORY =
            "ConnectionFactory";
            private static final String QUEUE = "queue/B";

            public static void main(String[] args) {
            Context initCtx;
            QueueConnectionFactory factory;
            Queue queue;
            QueueConnection conn;
            QueueSession session;
            QueueReceiver receiver;
            TextMessage request;

            try {
            //Obtain an initial context
            initCtx = new InitialContext();
            //Lookup Connection Factory and Queue name
            factory = (QueueConnectionFactory) initCtx.lookup(QUEUE_CONN_FACTORY);
            queue = (Queue) initCtx.lookup(QUEUE);

            //Create and start a Queue connection using the Factory
            conn = (QueueConnection)factory.createQueueConnection();
            conn.start();
            //Open a Queue session on this connection
            session = conn.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
            //Create a listener to receive messages from the Queue
            receiver = session.createReceiver(queue);
            //Send every message received to Standard Out
            while (true) {
            System.out.println("succeed all right?");
            request = (TextMessage) receiver.receive();
            System.out.println("Message Received: " + request.getText());
            }
            } catch (NamingException ne) {
            ne.printStackTrace();
            } catch (JMSException jms) {
            jms.printStackTrace();
            }
            }
            }

            it always halt at the following sentence:
            request = (TextMessage) receiver.receive();
            when I force it to finish,the server(localhost) list series of errors ,that is the problem you answer.
            what cause it and how to resolve the problem.