Bruce Cui [
http://community.jboss.org/people/brucecui] created the discussion
"NullPointerException problem when console tried to start new sub process, triggered
by signal sent from async task"
To view the discussion, visit:
http://community.jboss.org/message/613255#613255
--------------------------------------------------------------
I know the subject is not quite clear. But problem itself does look that complex to me.
Here is a background brief:
I tried to use jBPM to drive some backend batch processes, which basically requires
multi-threading. After struggling with various problems, asking around in the forum,
changing and rebuilding source codes, I finally came to this stage: the console can now
pass ksession(actually kruntime) to my self-defined work item handlers, and I can trigger
the event by calling ksession's signal method with return value to the
processInstance.
This was suppose to be a maybe not perfect, but at least a working solution. But problems
just come after another. Now I found that once the process contains sub process, it would
throw out NullPointerException at the point when trying to add the sub process to
persistance:
"org.jbpm.persistence.processinstance.JPAProcessInstanceManager.addProcessInstance(JPAProcessInstanceManager.java:37)".
Another question is, I found that when I called the signalEvent method of the ksession, it
actually took over the process and run the rest in this thread. So, say if I have a
infinite loop, and an async task runs every round, and an signal event starts after it
waiting for return event. If the task calls the signalEvent method every time, once a new
thread takes over the process, will the old thread end? Or it will keep accumulating?
Below is the log output of the first problem:
2011-07-04 19:13:01,092 INFO [STDOUT] (Thread-107) kruntime:
org.drools.impl.StatefulKnowledgeSessionImpl@7b2b39
2011-07-04 19:13:01,092 INFO [STDOUT] (Thread-107) process: WorkflowProcessInstance8
[processId=com.xxxx.CustomerLoader,state=1]
2011-07-04 19:13:01,092 INFO [STDOUT] (Thread-107) process instance id: 8
2011-07-04 19:13:01,092 INFO [STDOUT] (Thread-107) File collector done. Signal out
2011-07-04 19:13:01,107 INFO [STDOUT] (Thread-107) Collector Event Received
2011-07-04 19:13:01,138 ERROR [STDERR] (Thread-107) Exception in thread
"Thread-107"
2011-07-04 19:13:01,138 ERROR [STDERR] (Thread-107) org.drools.RuntimeDroolsException:
Unexpected exception executing action
org.jbpm.process.instance.event.DefaultSignalManager$SignalProcessInstanceAction@c5ab84
2011-07-04 19:13:01,138 ERROR [STDERR] (Thread-107) at
org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:996)
2011-07-04 19:13:01,138 ERROR [STDERR] (Thread-107) at
org.drools.impl.StatefulKnowledgeSessionImpl.executeQueuedActions(StatefulKnowledgeSessionImpl.java:845)
2011-07-04 19:13:01,138 ERROR [STDERR] (Thread-107) at
org.jbpm.process.instance.event.DefaultSignalManager.signalEvent(DefaultSignalManager.java:89)
2011-07-04 19:13:01,138 ERROR [STDERR] (Thread-107) at
org.jbpm.process.instance.ProcessRuntimeImpl.signalEvent(ProcessRuntimeImpl.java:359)
2011-07-04 19:13:01,138 ERROR [STDERR] (Thread-107) at
org.drools.impl.StatefulKnowledgeSessionImpl.signalEvent(StatefulKnowledgeSessionImpl.java:327)
2011-07-04 19:13:01,138 ERROR [STDERR] (Thread-107) at
com.sample.FileCollector.run(FileCollector.java:74)
2011-07-04 19:13:01,138 ERROR [STDERR] (Thread-107) Caused by:
java.lang.NullPointerException
2011-07-04 19:13:01,138 ERROR [STDERR] (Thread-107) at
org.jbpm.persistence.processinstance.JPAProcessInstanceManager.addProcessInstance(JPAProcessInstanceManager.java:37)
2011-07-04 19:13:01,138 ERROR [STDERR] (Thread-107) at
org.jbpm.process.instance.AbstractProcessInstanceFactory.createProcessInstance(AbstractProcessInstanceFactory.java:36)
2011-07-04 19:13:01,138 ERROR [STDERR] (Thread-107) at
org.jbpm.process.instance.ProcessRuntimeImpl.startProcess(ProcessRuntimeImpl.java:168)
2011-07-04 19:13:01,138 ERROR [STDERR] (Thread-107) at
org.jbpm.process.instance.ProcessRuntimeImpl.createProcessInstance(ProcessRuntimeImpl.java:140)
2011-07-04 19:13:01,138 ERROR [STDERR] (Thread-107) at
org.jbpm.process.instance.ProcessRuntimeImpl.startProcess(ProcessRuntimeImpl.java:121)
2011-07-04 19:13:01,138 ERROR [STDERR] (Thread-107) at
org.drools.common.AbstractWorkingMemory.startProcess(AbstractWorkingMemory.java:1095)
2011-07-04 19:13:01,138 ERROR [STDERR] (Thread-107) at
org.drools.impl.StatefulKnowledgeSessionImpl.startProcess(StatefulKnowledgeSessionImpl.java:306)
2011-07-04 19:13:01,138 ERROR [STDERR] (Thread-107) at
org.jbpm.workflow.instance.node.SubProcessNodeInstance.internalTrigger(SubProcessNodeInstance.java:121)
2011-07-04 19:13:01,138 ERROR [STDERR] (Thread-107) at
org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:122)
2011-07-04 19:13:01,138 ERROR [STDERR] (Thread-107) at
org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerConnection(NodeInstanceImpl.java:185)
2011-07-04 19:13:01,138 ERROR [STDERR] (Thread-107) at
org.jbpm.workflow.instance.node.SplitInstance.internalTrigger(SplitInstance.java:129)
2011-07-04 19:13:01,138 ERROR [STDERR] (Thread-107) at
org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:122)
2011-07-04 19:13:01,138 ERROR [STDERR] (Thread-107) at
org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerConnection(NodeInstanceImpl.java:185)
2011-07-04 19:13:01,138 ERROR [STDERR] (Thread-107) at
org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:150)
2011-07-04 19:13:01,138 ERROR [STDERR] (Thread-107) at
org.jbpm.workflow.instance.node.JoinInstance.triggerCompleted(JoinInstance.java:152)
2011-07-04 19:13:01,138 ERROR [STDERR] (Thread-107) at
org.jbpm.workflow.instance.node.JoinInstance.internalTrigger(JoinInstance.java:52)
2011-07-04 19:13:01,138 ERROR [STDERR] (Thread-107) at
org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:122)
2011-07-04 19:13:01,138 ERROR [STDERR] (Thread-107) at
org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerConnection(NodeInstanceImpl.java:185)
2011-07-04 19:13:01,138 ERROR [STDERR] (Thread-107) at
org.jbpm.workflow.instance.node.SplitInstance.internalTrigger(SplitInstance.java:129)
2011-07-04 19:13:01,138 ERROR [STDERR] (Thread-107) at
org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:122)
2011-07-04 19:13:01,138 ERROR [STDERR] (Thread-107) at
org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerConnection(NodeInstanceImpl.java:185)
2011-07-04 19:13:01,138 ERROR [STDERR] (Thread-107) at
org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:150)
2011-07-04 19:13:01,138 ERROR [STDERR] (Thread-107) at
org.jbpm.workflow.instance.node.JoinInstance.triggerCompleted(JoinInstance.java:152)
2011-07-04 19:13:01,138 ERROR [STDERR] (Thread-107) at
org.jbpm.workflow.instance.node.JoinInstance.internalTrigger(JoinInstance.java:52)
2011-07-04 19:13:01,138 ERROR [STDERR] (Thread-107) at
org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:122)
2011-07-04 19:13:01,138 ERROR [STDERR] (Thread-107) at
org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerConnection(NodeInstanceImpl.java:185)
2011-07-04 19:13:01,138 ERROR [STDERR] (Thread-107) at
org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:150)
2011-07-04 19:13:01,138 ERROR [STDERR] (Thread-107) at
org.jbpm.workflow.instance.node.ActionNodeInstance.triggerCompleted(ActionNodeInstance.java:55)
2011-07-04 19:13:01,138 ERROR [STDERR] (Thread-107) at
org.jbpm.workflow.instance.node.ActionNodeInstance.internalTrigger(ActionNodeInstance.java:51)
2011-07-04 19:13:01,138 ERROR [STDERR] (Thread-107) at
org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:122)
2011-07-04 19:13:01,138 ERROR [STDERR] (Thread-107) at
org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerConnection(NodeInstanceImpl.java:185)
2011-07-04 19:13:01,138 ERROR [STDERR] (Thread-107) at
org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:150)
2011-07-04 19:13:01,138 ERROR [STDERR] (Thread-107) at
org.jbpm.workflow.instance.node.ActionNodeInstance.triggerCompleted(ActionNodeInstance.java:55)
2011-07-04 19:13:01,138 ERROR [STDERR] (Thread-107) at
org.jbpm.workflow.instance.node.ActionNodeInstance.internalTrigger(ActionNodeInstance.java:51)
2011-07-04 19:13:01,138 ERROR [STDERR] (Thread-107) at
org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:122)
2011-07-04 19:13:01,138 ERROR [STDERR] (Thread-107) at
org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerConnection(NodeInstanceImpl.java:185)
2011-07-04 19:13:01,138 ERROR [STDERR] (Thread-107) at
org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:150)
2011-07-04 19:13:01,138 ERROR [STDERR] (Thread-107) at
org.jbpm.workflow.instance.node.EventNodeInstance.triggerCompleted(EventNodeInstance.java:66)
2011-07-04 19:13:01,138 ERROR [STDERR] (Thread-107) at
org.jbpm.workflow.instance.node.EventNodeInstance.signalEvent(EventNodeInstance.java:50)
2011-07-04 19:13:01,138 ERROR [STDERR] (Thread-107) at
org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.signalEvent(WorkflowProcessInstanceImpl.java:353)
2011-07-04 19:13:01,138 ERROR [STDERR] (Thread-107) at
org.jbpm.process.instance.event.DefaultSignalManager$SignalProcessInstanceAction.execute(DefaultSignalManager.java:117)
2011-07-04 19:13:01,138 ERROR [STDERR] (Thread-107) at
org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:994)
2011-07-04 19:13:01,138 ERROR [STDERR] (Thread-107) ... 5 more
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/613255#613255]
Start a new discussion in jBPM at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]