NullPointer exception is thrown when trying to access DBConcepts assigned as childs to a parent concept

NullPointer exception is thrown when trying to access DBConcepts assigned as childs to a parent concept

book

Article ID: KB0082789

calendar_today

Updated On:

Products Versions
TIBCO BusinessEvents Enterprise Edition 5.4.x

Description

NullPointer exception is thrown trying to access DBConcepts assigned as childs to a parent concept

<timestamp> <agent> Error [<workerThread>] - [runtime.service] [<inference-class>] Got runtime exception while executing Rule <Rule> Action <reference> Objects <inputEvent>
java.lang.NullPointerException
    at be.gen.Rules.loadSettings$loadSettings_a.execute(loadSettings.java:40)
    at com.tibco.cep.kernel.core.rete.ReteWM.resolveConflict(SourceFile:401)
    at com.tibco.cep.kernel.core.rete.ReteWM.void(SourceFile:377)
    at com.tibco.cep.kernel.core.rete.ReteWM.fireRepeatEvent(SourceFile:2208)
    at com.tibco.cep.runtime.session.impl.RuleSessionImpl$5.doTxnWork(RuleSessionImpl.java:1778)
    at com.tibco.cep.kernel.core.rete.BeTransaction.run(SourceFile:156)
    at com.tibco.cep.kernel.core.rete.BeTransaction.execute(SourceFile:101)
    at com.tibco.cep.runtime.session.impl.RuleSessionImpl.fireRepeatEvent(RuleSessionImpl.java:1784)
    at com.tibco.cep.runtime.service.cluster.scheduler.AgentTimeManager$RepeatAssertEventTask.run(AgentTimeManager.java:459)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at com.tibco.cep.runtime.util.CustomBEManagedThread.run(CustomBEManagedThread.java:24)

Issue/Introduction

NullPointer exception thrown try to access DBConcepts assigned as childs to a parent concept

Environment

All Operating Systems

Resolution

Issue caused by Project code. DBConcepts returned by a database query will not be added to the working memory (created), but you can assign them as a child of an existing parent, which caused the NullPointer exception when trying to load the childs from parent concept.
It is required to add the returned DBConcepts to the working memory using catalog function Database.assertDBInstance().

eg:
Database.setCurrentConnection("/SharedResources/SFDatabase.sharedjdbc");
Concepts.testSupport.dbo.Currency[] RcvRpt = Database.queryUsingSQL("/Concepts/testSupport/dbo/Currency","select * from dbo.Currency",false);
for (int i=0;i<RcvRpt@length;i++) {
	Database.assertDBInstance(RcvRpt[i],true);
	cp.childs[cp.childs@length]=RcvRpt[i];
}