JMS Topic Subscriber activity fails with a Null Pointer exception when subscribing to a monitoring topic message.

JMS Topic Subscriber activity fails with a Null Pointer exception when subscribing to a monitoring topic message.

book

Article ID: KB0087680

calendar_today

Updated On:

Products Versions
TIBCO ActiveMatrix BusinessWorks -
Not Applicable -

Description

Description:
1). Post a message on a queue in EMS broker setting JMS expiration to a value in seconds. No receivers are running on the queue.

2). Subscribe to monitor topic for that particular queue to receive monitor messages when a message prematurely exits due to expiration.

3). When the subscriber starts and tries to receive the monitor message, it fails with a parsing error and a Null pointer exception.
Symptoms:
The Topic Subscriber activity fails with the following exception:

<?xml version = "1.0" encoding = "UTF-8"?>
<ns0:ErrorReport xmlns:ns0 = "http://www.tibco.com/pe/EngineTypes">
    <StackTrace>Job-44001 Error in [BusinessProject/BusinessProcesses/MainProcesses/receiveAlertSummaryEmailMessage.process/JMS Topic Subscriber]
There was an error while parsing a message.
    at com.tibco.plugin.jms.service.JMSEventContextProcessor.postProcess(JMSEventContextProcessor.java:47)
    at com.tibco.plugin.share.jms.impl.JMSEventContext.postProcess(JMSEventContext.java:232)
    at com.tibco.pe.core.ProcessGroup.eval(ProcessGroup.java:54)
    at com.tibco.pe.plugin.Activity.eval(Activity.java:241)
    at com.tibco.pe.core.TaskImpl.eval(TaskImpl.java:574)
    at com.tibco.pe.core.Job.a(Job.java:712)
    at com.tibco.pe.core.Job.k(Job.java:501)
    at com.tibco.pe.core.JobDispatcher$JobCourier.a(JobDispatcher.java:249)
    at com.tibco.pe.core.JobDispatcher$JobCourier.run(JobDispatcher.java:200)
caused by: com.tibco.plugin.share.jms.impl.JMSExceptionWrapper: java.lang.NullPointerException
    at com.tibco.plugin.share.jms.impl.JMSPluginException.<init>(JMSPluginException.java:22)
    at com.tibco.plugin.share.jms.impl.JMSReceiveException.<init>(JMSReceiveException.java:15)
    at com.tibco.plugin.jms.service.JMSEventContextProcessor.postProcess(JMSEventContextProcessor.java:47)
    at com.tibco.plugin.share.jms.impl.JMSEventContext.postProcess(JMSEventContext.java:232)
    at com.tibco.pe.core.ProcessGroup.eval(ProcessGroup.java:54)
    at com.tibco.pe.plugin.Activity.eval(Activity.java:241)
    at com.tibco.pe.core.TaskImpl.eval(TaskImpl.java:574)
    at com.tibco.pe.core.Job.a(Job.java:712)
    at com.tibco.pe.core.Job.k(Job.java:501)
    at com.tibco.pe.core.JobDispatcher$JobCourier.a(JobDispatcher.java:249)
    at com.tibco.pe.core.JobDispatcher$JobCourier.run(JobDispatcher.java:200)
Caused by: java.lang.NullPointerException
    at com.tibco.plugin.share.jms.service.JMSMessageDeserializer.for(JMSMessageDeserializer.java:439)
    at com.tibco.plugin.share.jms.service.JMSMessageDeserializer.messageToXiNode(JMSMessageDeserializer.java:115)
    at com.tibco.plugin.jms.service.JMSEventContextProcessor.postProcess(JMSEventContextProcessor.java:40)
    ... 8 more
    </StackTrace>
    <Msg>There was an error while parsing a message.</Msg>
    <FullClass>com.tibco.plugin.share.jms.impl.JMSReceiveException</FullClass>
    <Class>JMSReceiveException</Class>
    <ProcessStack>BusinessProject/BusinessProcesses/MainProcesses/receiveAlertSummaryEmailMessage.process/JMS Topic Subscriber</ProcessStack>
    <MsgCode>BW-JMS-100043</MsgCode>
    <Data>
        <ns1:JMSReceiveException xmlns:ns1 = "http://schemas.tibco.com/bw/plugins/jms/5.0/jmsExceptions">
            <msg>There was an error while parsing a message.</msg>
            <msgCode>BW-JMS-100043</msgCode>
        </ns1:JMSReceiveException>
    </Data>
</ns0:ErrorReport>

Cause:
The type of messages published on $sys.monitor.> topics by the EMS server is a MapMessage. They are not the regular TextMessage. In your BW TopicSubscriber if you set the message type as Text Message, the message parsing will fail which will trigger a “NullPointer Exception” which is an expected behavior. You can run a standlone Java TopicSubscriber shipped with EMS installation to see how the message looks like and create an appropriate mapping in your BW Topic Subscriber according to it.

Issue/Introduction

JMS Topic Subscriber activity fails with a Null Pointer exception when subscribing to a monitoring topic message.

Resolution

Set the “Message Type” of the JMS Topic Subscriber activity to Map Message and after the TopicSubscriber activity, add a Java code activity for which binary input will be the Message Bytes of the TopicSubscriber activity. Processs the Message Bytes in the Java code as follows:

Message msg = Tibjms.createFromBytes(getinput());
setoutput(((TextMessage)msg).getText());

Now the output of the Java code will contain the text body of the message that expired from the queue. Attached is a sample BW project that achieves this. (Filename: MonitorExpiry.zip).

Attachments

JMS Topic Subscriber activity fails with a Null Pointer exception when subscribing to a monitoring topic message. get_app