Friday, October 11, 2013

How to look inside a JMS ObjectMessage
In OSB, all reporting messages are instances of com.bea.wli.reporting.jmsprovider.runtime.ReportMessage, and in the JMS message they are stored as an ObjectMessage. So, you won't be able to view their content in the WebLogic console, when they end up in the jmsResources module/dist_wli.reporting.jmsprovider_error.queue_auto queue.

Solution: export the message (one by one) into a jmsmessages.xml file using the WebLogic console Export tool (show messages).
in the resulting XML, the Object is expressed in base64 encoded format (text), in a xml tag mes:Object. Copy this text and put in a messagebody.xml (this can be automated, of course).

make sure these 2 jars are in WLST classpath (you can directly edit file):

from org.apache.commons.codec.binary import Base64
f = open('messagebody.xml', 'r')
bytes = Base64.decodeBase64(

from import ByteArrayInputStream
from import ObjectInputStream
inputStream = ByteArrayInputStream(bytes)
objectStream = ObjectInputStream(inputStream)
obj = objectStream.readObject()

print obj.class
#it will print com.bea.wli.reporting.jmsprovider.runtime.ReportMessage

print obj.getXmlPayload()
print obj.getMetadata()

No comments: