7 Replies Latest reply on Sep 30, 2002 1:22 AM by Joel Vogt

    ERROR [STDERR] Got Message: org.jboss.mq.SpyTextMessage

    Mike Newbie

      I test a very simple message client using JBOSS, I am new to it, when I run it, I got the follow error message
      ERROR [STDERR] Got Message: org.jboss.mq.SpyTextMessage
      but no exception flow from the client, the code of the program is show below:

      package test;
      /*
      *
      * Copyright 2001 Sun Microsystems, Inc. All Rights Reserved.
      *
      * This software is the proprietary information of Sun Microsystems, Inc.
      * Use is subject to license terms.
      *
      */

      import javax.jms.*;
      import javax.naming.*;
      import java.util.Properties;
      import java.lang.Throwable;

      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 {

      Properties props = new Properties();
      props.setProperty("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
      props.setProperty("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
      props.setProperty("java.naming.provider.url","localhost:1099");

      jndiContext = new InitialContext(props);
      } catch (NamingException e) {
      System.out.println("Could not create JNDI " +
      "context: " + e.toString());
      System.exit(1);
      }

      try {
      queueConnectionFactory = (QueueConnectionFactory)
      jndiContext.lookup
      ("ConnectionFactory");
      queue = (Queue) jndiContext.lookup("queue/testQueue");
      } 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 (Throwable 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

      So what's wrong with my program?