1 Reply Latest reply on Apr 4, 2005 9:56 AM by jonasl

    Error writing to queue

    jonasl Newbie

      I have written a small client, that is supposed to send TextMessages to queue/testQueue, but I get a strange error in the server.log.

      Im running a fresh install of 4.0.1sp1 on windows.

      Here is my client:

      import javax.jms.*;
      import javax.naming.*;
      
      
      public class test {
      
       public static void main(String [] args) throws Exception {
       // set properties for at kunne lave lookup til JBoss JNDI
       System.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
       System.setProperty("java.naming.factory.url.pkgs", "org.jnp.interfaces");
       System.setProperty("java.naming.provider.url", "localhost:1099");
      
       InitialContext jndiContext = new InitialContext();
       QueueConnectionFactory factory = (QueueConnectionFactory)
       jndiContext.lookup("ConnectionFactory");
      
       Queue queue = (Queue)
       jndiContext.lookup("queue/testQueue");
      
       QueueConnection connect = factory.createQueueConnection();
      
       QueueSession session = connect.createQueueSession(true,0);
      
       QueueSender sender = session.createSender(queue);
      
       TextMessage textMsg = session.createTextMessage();
       for(int i=0; i<100;i++){
       textMsg.setText("This is a message...hello nr. "+i);
       sender.send(textMsg);
       }
       connect.close();
      
       }
      }


      And the error:

      2005-04-04 14:17:14,062 DEBUG [org.jboss.mq.il.uil2.SocketManager] Begin ReadTask.run
      2005-04-04 14:17:14,062 DEBUG [org.jboss.mq.il.uil2.SocketManager] Created ObjectInputStream
      2005-04-04 14:17:14,062 DEBUG [org.jboss.mq.il.uil2.SocketManager] Begin WriteTask.run
      2005-04-04 14:17:14,062 DEBUG [org.jboss.mq.il.uil2.SocketManager] Created ObjectOutputStream
      2005-04-04 14:17:14,109 DEBUG [org.jboss.mq.il.uil2.ServerSocketManagerHandler] Setting up the UILClientIL Connection
      2005-04-04 14:17:14,109 DEBUG [org.jboss.mq.il.uil2.ServerSocketManagerHandler] The UILClientIL Connection is set up
      2005-04-04 14:17:14,218 DEBUG [org.jboss.mq.il.uil2.ServerSocketManagerHandler] Exiting on IOE
      java.net.SocketException: socket closed
       at java.net.SocketInputStream.socketRead0(Native Method)
       at java.net.SocketInputStream.read(SocketInputStream.java:129)
       at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
       at java.io.BufferedInputStream.read(BufferedInputStream.java:235)
       at org.jboss.util.stream.NotifyingBufferedInputStream.read(NotifyingBufferedInputStream.java:67)
       at java.io.ObjectInputStream$PeekInputStream.peek(ObjectInputStream.java:2200)
       at java.io.ObjectInputStream$BlockDataInputStream.readBlockHeader(ObjectInputStream.java:2380)
       at java.io.ObjectInputStream$BlockDataInputStream.refill(ObjectInputStream.java:2447)
       at java.io.ObjectInputStream$BlockDataInputStream.read(ObjectInputStream.java:2519)
       at java.io.ObjectInputStream$BlockDataInputStream.readByte(ObjectInputStream.java:2668)
       at java.io.ObjectInputStream.readByte(ObjectInputStream.java:864)
       at org.jboss.mq.il.uil2.SocketManager$ReadTask.run(SocketManager.java:285)
       at java.lang.Thread.run(Thread.java:595)
      2005-04-04 14:17:14,234 DEBUG [org.jboss.mq.il.uil2.SocketManager] End ReadTask.run
      2005-04-04 14:17:14,234 DEBUG [org.jboss.mq.il.uil2.SocketManager] End WriteTask.run


        • 1. Re: Error writing to queue
          jonasl Newbie

          I tried the example from http://www.jboss.org/wiki/Wiki.jsp?page=QueueExample

          I get this output, but I get an other exception in my server.log.

          C:\slet>java -cp .;jbossall-client.jar Client
          Creating jndi context - alternatively use a jndi.properties
          Looking up queue
          Looking up connection factory
          Creating connection
          Creating session
          Creating sender
          Creating message
          Sending message
          Creating receiver
          Try to receive message, it will not work
          You have to start the connection before receiving messages
          This receive will work
          Got message: SpyTextMessage {
          Header {
           jmsDestination : QUEUE.testQueue
           jmsDeliveryMode : 2
           jmsExpiration : 0
           jmsPriority : 4
           jmsMessageID : ID:1-11126226935151
           jmsTimeStamp : 1112622693515
           jmsCorrelationID: null
           jmsReplyTo : null
           jmsType : null
           jmsRedelivered : false
           jmsProperties : {}
           jmsPropReadWrite: false
           msgReadOnly : true
           producerClientId: ID:1
          }
          Body {
           text :hello
          }
          }


          Error from server.log:

          2005-04-04 15:51:33,375 DEBUG [org.jboss.mq.il.uil2.SocketManager] Begin ReadTask.run
          2005-04-04 15:51:33,375 DEBUG [org.jboss.mq.il.uil2.SocketManager] Begin WriteTask.run
          2005-04-04 15:51:33,375 DEBUG [org.jboss.mq.il.uil2.SocketManager] Created ObjectOutputStream
          2005-04-04 15:51:33,375 DEBUG [org.jboss.mq.il.uil2.SocketManager] Created ObjectInputStream
          2005-04-04 15:51:33,421 DEBUG [org.jboss.mq.il.uil2.ServerSocketManagerHandler] Setting up the UILClientIL Connection
          2005-04-04 15:51:33,421 DEBUG [org.jboss.mq.il.uil2.ServerSocketManagerHandler] The UILClientIL Connection is set up
          2005-04-04 15:51:33,671 DEBUG [org.jboss.mq.il.uil2.ServerSocketManagerHandler] Exiting on IOE
          java.io.EOFException
           at java.io.ObjectInputStream$BlockDataInputStream.readByte(ObjectInputStream.java:2670)
           at java.io.ObjectInputStream.readByte(ObjectInputStream.java:864)
           at org.jboss.mq.il.uil2.SocketManager$ReadTask.run(SocketManager.java:285)
           at java.lang.Thread.run(Thread.java:595)
          2005-04-04 15:51:33,671 DEBUG [org.jboss.mq.il.uil2.SocketManager] End ReadTask.run
          2005-04-04 15:51:33,671 DEBUG [org.jboss.mq.il.uil2.SocketManager] End WriteTask.run