After re-loading a session, and trying to send it an Event, I get the following
NullPointerException:
java.lang.NullPointerException
at
org.drools.impl.StatefulKnowledgeSessionImpl$ProcessEventListenerWrapper.beforeRuleFlowNodeTriggered(StatefulKnowledgeSessionImpl.java:674)
at
org.drools.event.RuleFlowEventSupport.fireBeforeRuleFlowNodeTriggered(RuleFlowEventSupport.java:147)
at org.drools.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:110)
at
org.drools.workflow.instance.node.EventNodeInstance.signalEvent(EventNodeInstance.java:50)
at
org.drools.workflow.instance.impl.WorkflowProcessInstanceImpl.signalEvent(WorkflowProcessInstanceImpl.java:272)
at
com.csatp.svc.rulesmgr.claim.ClaimsDemoJpaTest.validateDocumentWorkflow2(ClaimsDemoJpaTest.java:209)
My code is pretty straightforward:
StatefulKnowledgeSession session = JPAKnowledgeService.loadStatefulKnowledgeSession(
1, knowledgeBase, null, env );
ProcessInstance process = session.getProcessInstance(2);
process.signalEvent("ReceiveDocsEvent", null);
that same code (and Flow) works on a session created from
knowledgeBase.newStatefulKnowledgeSession();
This is difficult for me to debug, but here's what I have:
In org.drools.event.RuleFlowEventSupport.fireBeforeRuleFlowNodeTriggered(), the code is
getting listeners:
final Iterator<RuleFlowEventListener> iter = getEventListenersIterator();
then iterating over them. In the session created from a regular knowledgeBase,
"iter" has the following values
iter = {java.util.concurrent.CopyOnWriteArrayList$COWIterator @ 3411}
snapshot = {java.lang.Object[2] @ 3416}
[0] = {org.drools.audit.WorkingMemoryFileLogger @ 3417}
events = {java.util.ArrayList @ 3419} size = 77
fileName = {java.lang.String @ 3420}"log/claimsdemo"
maxEventsInMemory = 1000
nbOfFile = 0
split = true
initialized = false
filters = {java.util.ArrayList @ 3421} size = 0
[1] = {org.drools.impl.StatefulKnowledgeSessionImpl$ProcessEventListenerWrapper @
3418}
listener = {com.csatp.svc.rulesmgr.claim.TrackingProcessEventListener @ 3396}
While the session created using JPAKnowledgeService has the following values for
"iter"
iter = {java.util.concurrent.CopyOnWriteArrayList$COWIterator @ 3803}
snapshot = {java.lang.Object[1] @ 3805}
[0] = {org.drools.impl.StatefulKnowledgeSessionImpl$ProcessEventListenerWrapper @
3806}
listener = null
I can see that the EventListeners should be setup in AbstractEventSupport and it's
implementing classes,
and they are clearly missing, but I'm not sure where this is going wrong.
I'll gladly fix this, but just don't know where to start, if you have any ideas
that can help, I'd greatly appreciate it!
Bill