Troubleshooting
Problem
A message-driven bean (MDB) running in WebSphere Application Server V5 or V6 may fail to process an incoming message and receive the following exception: java.lang.ClassCastException: com.ibm.jms.JMSBytesMessage
Cause
The problem occurs when a JMS message header is missing from a message. This can happen when the JMS destination that is used by the application that sends the message to the queue does not have the Target Client property set correctly. Because the message header is missing, WebSphere Application Server cannot determine the format of the message and delivers it to the MDB as a JMSBytesMessage. The MDB is not expecting this type of message, and the ClassCastException occurs when it tries to process the message.
Resolving The Problem
To correct the problem, the Target Client property of the JMS destination that is used to send the message should be changed. If the sender application is running in WebSphere Application Server, you can edit the JMS destination in the Admin Console. Expand Resources, select WebSphere MQ JMS Provider, select WebSphere MQ Queue Destinations, and then select your JMS destination. Change the value of the Target Client property to JMS.
If the sender application is running outside of WebSphere Application Server, you can either use the JMSAdmin tool to set the targetClient on your JMS destination to 0 (equivalent to the "JMS" setting in the WebSphere Application Server Admin Console), or call setTargetClient(0) on the JMS destination object in your application before sending the message.
Was this topic helpful?
Document Information
Modified date:
15 June 2018
UID
swg21220378