BytesMessage problem
843830Jun 24 2003 — edited Jul 12 2006I am trying to send and receive a BytesMessage and when I try to read back a BytesMessage I am getting the exception:
java.lang.ClassCastException: com.ibm.jms.JMSTextMessage
I know this means that it is expecting a TextMessage, but why is this? I understood that if you send a BytesMessage, it should return one?
Here is the abbreviated code:
Message inMessage = null;
javax.jms.BytesMessage outMessage = session.createBytesMessage();
outMessage.writeBytes(getMessage.getBytes()); //convert string to bytes
queueSender.send(outMessage);
session.commit();
System.out.println("Reading the reply back again");
inMessage = queueReceiver.receive(60000);
javax.jms.BytesMessage abytemsg = (javax.jms.BytesMessage) inMessage;
Any hint would be helpful at this point. Thanks.