Sunday, August 1, 2010

com.bea.xml.XmlException: error: The document is not a WLJMSMessage@

When importing a message in a Queue in WebLogic, make sure the XML complies to a specific schema:

element WLJMSMessage

An empty message looks like:

<?xml version="1.0" encoding="UTF-8"?>
<mes:WLJMSMessage xmlns:mes="">

If you process this message with a MDB,

public void onMessage(Message message) {
TextMessage tm = (TextMessage)message;
try {
System.out.println("!!!message " + tm.getText());
} catch (JMSException e) {


you will get this:

MessageDrivenBean threw an Exception in onMessage(). The exception was: java.lang.ClassCastException: weblogic.jms.common.HdrMessageImpl

Since delivery fails, I also get this:

The Message-Driven EJB: MQGeoFeedMDB is throwing exception when processing the messages. Delivery failed after 139 attempts. The EJB container will suspend the message delivery for 60 seconds before retry.

A complete sample WL Message has this format:

<?xml version="1.0" encoding="UTF-8"?>
<mes:WLJMSMessage xmlns:mes="">
<mes:property name="JMSXDeliveryCount">
<mes:Text>your message here</mes:Text>

No comments: