I am experiencing the exact same behavior.  Did you figure out what was wrong?  My 
first thought was that the queue connection was not closed, but explicitly calling 
queueConnection.close() did not make a difference.

Any thoughts?

Thanks,
Adam Rice

"hswen" wrote : Hi,
  | I have a stand alone MDB client that sends message to the defaule queue/A and a 
MDB that read the message from queue/A and display on the screen using System.out. I 
keep getting the Socket closed exception. Where do I go wrong? Thanks.
  | 
  | JBoss Version: 3.2.5
  | 
  | from the log:
  | 2004-08-14 14:17:49,375 DEBUG [org.jboss.mq.il.uil2.SocketManager] Begin 
ReadTask.run
  | 2004-08-14 14:17:49,375 DEBUG [org.jboss.mq.il.uil2.SocketManager] Begin 
WriteTask.run
  | 2004-08-14 14:17:49,375 DEBUG [org.jboss.mq.il.uil2.SocketManager] Created 
ObjectOutputStream
  | 2004-08-14 14:17:49,453 DEBUG [org.jboss.mq.il.uil2.SocketManager] Created 
ObjectInputStream
  | 2004-08-14 14:17:49,500 DEBUG [org.jboss.mq.il.uil2.ServerSocketManagerHandler] 
Setting up the UILClientIL Connection
  | 2004-08-14 14:17:49,500 DEBUG [org.jboss.mq.il.uil2.ServerSocketManagerHandler] 
The UILClientIL Connection is set up
  | 2004-08-14 14:18:28,078 DEBUG [org.jboss.mq.il.uil2.SocketManager] End 
WriteTask.run
  | 2004-08-14 14:18:28,078 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:183)
  |     at java.io.BufferedInputStream.read(BufferedInputStream.java:201)
  |     at 
org.jboss.util.stream.NotifyingBufferedInputStream.read(NotifyingBufferedInputStream.java:67)
  |     at java.io.ObjectInputStream$PeekInputStream.peek(ObjectInputStream.java:2133)
  |     at 
java.io.ObjectInputStream$BlockDataInputStream.readBlockHeader(ObjectInputStream.java:2313)
  |     at 
java.io.ObjectInputStream$BlockDataInputStream.refill(ObjectInputStream.java:2380)
  |     at 
java.io.ObjectInputStream$BlockDataInputStream.read(ObjectInputStream.java:2452)
  |     at 
java.io.ObjectInputStream$BlockDataInputStream.readByte(ObjectInputStream.java:2601)
  |     at java.io.ObjectInputStream.readByte(ObjectInputStream.java:845)
  |     at org.jboss.mq.il.uil2.SocketManager$ReadTask.run(SocketManager.java:279)
  |     at java.lang.Thread.run(Thread.java:534)
  | 2004-08-14 14:18:28,078 DEBUG [org.jboss.mq.il.uil2.SocketManager] End ReadTask.run
  | 
  | My MDB class
  | 
  | public class SimpleMessageBean implements MessageDrivenBean, 
  |     MessageListener {
  | 
  |     private transient MessageDrivenContext mdc = null;
  |     private Context context;
  |     
  |     public SimpleMessageBean() {
  |         System.out.println("In SimpleMessageBean.SimpleMessageBean()");
  |     }
  | 
  |     public void setMessageDrivenContext(MessageDrivenContext mdc) {
  |         System.out.println("In "
  |             + "SimpleMessageBean.setMessageDrivenContext()");
  |     this.mdc = mdc;
  |     }
  | 
  |     public void ejbCreate() {
  |     System.out.println("In SimpleMessageBean.ejbCreate()");
  |     }
  | 
  |     public void onMessage(Message inMessage) {
  |         TextMessage msg = null;
  | 
  |         try {
  |             if (inMessage instanceof TextMessage) {
  |                 msg = (TextMessage) inMessage;
  |                 System.out.println("MESSAGE BEAN: Message received: " 
  |                     + msg.getText());
  |             } else {
  |                 System.out.println("Message of wrong type: " 
  |                     + inMessage.getClass().getName());
  |             }
  |         } catch (JMSException e) {
  |             e.printStackTrace();
  |             mdc.setRollbackOnly();
  |         } catch (Throwable te) {
  |             te.printStackTrace();
  |         }
  |     }  // onMessage
  |     
  |     public void ejbRemove() {
  |         System.out.println("In SimpleMessageBean.remove()");
  |     }
  | 
  | } // class
  | 
  | ejb-jar.xml
  | <ejb-jar>
  |     <enterprise-beans>
  |             <message-driven>
  |                     <ejb-name>SimpleMessageBean</ejb-name>
  |                     <ejb-class>com.hp.mdb.SimpleMessageBean</ejb-class>
  |                     <transaction-type>Container</transaction-type>
  |                     <message-driven-destination>
  |                             <destination-type>javax.jms.Queue</destination-type>
  |                     </message-driven-destination>
  |                     <!--resource-ref>
  |                             <res-ref-name>jms/QCF</res-ref-name>
  |                             <res-type>javax.jms.QueueConnectionFactory</res-type>
  |                             <res-auth>Container</res-auth>
  |                     </resource-ref-->
  |             </message-driven>
  |     </enterprise-beans>
  | </ejb-jar>
  | 
  | jboss.xml
  | 
  | 
  | <enterprise-beans>
  |             <message-driven>
  |                     <ejb-name>SimpleMessageBean</ejb-name>
  |                     <destination-jndi-name>queue/A</destination-jndi-name>
  |                     <!--resource-ref>
  |                             <res-ref-name>jms/QCF</res-ref-name>
  |                             <resource-name>ConnectionFactory</resource-name>
  |                     </resource-ref-->
  |             </message-driven>
  |     </enterprise-beans>
  | 
  | 
  | My client class
  | 
  | public class SimpleMessageClient {
  | 
  |     public static void main(String[] args) {
  | 
  |         Context                 jndiContext = null;
  |         QueueConnectionFactory  queueConnectionFactory = null;
  |         QueueConnection         queueConnection = null;
  |         QueueSession            queueSession = null;
  |         Queue                   queue = null;
  |         QueueSender             queueSender = null;
  |         TextMessage             message = null;
  |         final int               NUM_MSGS = 3;
  | 
  |         try {
  |             Hashtable env = new Hashtable();
  |             env.put(Context.INITIAL_CONTEXT_FACTORY, 
"org.jnp.interfaces.NamingContextFactory");
  |             env.put(Context.PROVIDER_URL, "localhost:1099");
  |             jndiContext = new InitialContext(env);
  |         } catch (NamingException e) {
  |             System.out.println("Could not create JNDI " +
  |                 "context: " + e.toString());
  |             System.exit(1);
  |         }
  | 
  |         try {
  | //            queueConnectionFactory = 
(QueueConnectionFactory)jndiContext.lookup("java:comp/env/jms/QCF");
  |             queueConnectionFactory = 
(QueueConnectionFactory)jndiContext.lookup("UILConnectionFactory");
  |            queue = (Queue) jndiContext.lookup("queue/A");
  |         } catch (NamingException e) {
  |             System.out.println("JNDI lookup failed: " +
  |                 e.toString());
  |             System.exit(1);
  |         }
  | 
  |         try {
  |             queueConnection = 
  |                 queueConnectionFactory.createQueueConnection();
  |             queueSession = 
  |                 queueConnection.createQueueSession(false, 
  |                     Session.AUTO_ACKNOWLEDGE);
  |             queueSender = queueSession.createSender(queue);
  |             message = queueSession.createTextMessage();
  | 
  |             for (int i = 0; i < NUM_MSGS; i++) {
  |                 message.setText("This is message #" + (i + 1));
  |                 System.out.println("Sending message: " + 
  |                     message.getText());
  |                 queueSender.send(message);
  |             }
  | 
  |         } catch (JMSException e) {
  |             System.out.println("Exception occurred: " + e.toString());
  |         } finally {
  |             if (queueConnection != null) {
  |                 try {
  |                     queueConnection.close();
  |                 } catch (JMSException e) {}
  |             } // if
  |             System.exit(0);
  |         } // finally
  |     } // main
  | } // class
  | 

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3852946#3852946

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3852946


-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to