NullPointerException is thrown when XPath expression is used in a ThreadAffinity RuleFunction

NullPointerException is thrown when XPath expression is used in a ThreadAffinity RuleFunction

book

Article ID: KB0074865

calendar_today

Updated On:

Products Versions
TIBCO BusinessEvents Enterprise Edition 5.5.x/5.6.0/5.6.1

Description

When XPath version 1.0 is configured for the project and a ThreadAffinity RuleFunction's defined for an input destination.
At runtime a NullPointer exception (NPE) thrown when ThreadAffinity RuleFunction executes the XPath expression.

e.g.
java.lang.RuntimeException: java.lang.NullPointerException
    at com.tibco.be.functions.xpath.XPathHelper.executeXPath(SourceFile:331)
    at com.tibco.be.functions.xpath.XPathHelper.evalAsString(SourceFile:119)
    at com.tibco.be.functions.xpath.XPathHelper.evalAsString2(SourceFile:132)
    at be.gen.RuleFunctions.StringrfThreadAffinity$9y002fEvents$9y002fevMain$.rfThreadAffinity(StringrfThreadAffinity$9y002fEvents$9y002fevMain$.java:11)
    at be.gen.RuleFunctions.rfThreadAffinity.invoke(rfThreadAffinity.java:11)
    at com.tibco.cep.runtime.scheduler.impl.WorkerBasedControllerV2$WorkerTaskHashProvider.getHash(WorkerBasedControllerV2.java:555)
    at com.tibco.cep.runtime.scheduler.impl.HashedDispatcherThreadPoolImpl.execute(HashedDispatcherThreadPoolImpl.java:170)
    at com.tibco.cep.runtime.scheduler.impl.WorkerBasedControllerV2.processEvent(WorkerBasedControllerV2.java:395)
    at com.tibco.cep.driver.jms.JmsReceiver.a(SourceFile:391)
    at com.tibco.cep.driver.jms.JmsReceiver.if(SourceFile:242)
    at com.tibco.cep.driver.jms.JmsReceiver.call(SourceFile:116)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.NullPointerException
    at com.tibco.be.functions.xpath.XQueryExprContext.a(SourceFile:164)
    at com.tibco.be.functions.xpath.XQueryExprContext.execute(SourceFile:144)
    at com.tibco.be.functions.xpath.XPathHelper.executeXPath(SourceFile:325)
    ... 14 more

Environment

All Operating Systems

Resolution

To avoid the NPE update your project to use XPath version 2.0 (Right Click on Project -> Properties).

Note: This is identified as a product issue related to the XPath version 1.0 (CR number: BE-28744).

Issue/Introduction

NullPointerException is thrown when XPath expression is used in a ThreadAffinity RuleFunction