0 Replies Latest reply on Oct 26, 2004 12:18 AM by wikey

    bytemessage

    wikey

      Hello,

      I'm trying to send bytemessage thru JMS, but failed where i receive error message

      java.lang.ClassCastException: org.jboss.mq.SpyTextMessage

      I've tried to check some forum but unfortunately not much info found.


      Snipet sender
      =========
      String textPub = "hello";
      BytesMessage byteMessage = session.createBytesMessage();
      byteMessage.writeInt(textPub.length());
      byteMessage.writeBytes(textPub.getBytes());
      send.publish(byteMessage);

      Snipet Receiver
      ==========
      BytesMessage byteMessage = (BytesMessage) message;
      int strLength = byteMessage.readInt();
      byte[] strBytes = new byte[strLength];
      byteMessage.readBytes(strBytes);
      String str1 = new String(strBytes);