that sounds little bit strange especially when you say that it works ok on clean installation. That could mean that you don't retract process instance from working memory (session) when process is completed. In that case it will try to update variable of a process instance that is not up to date (most likely completed) but still remains in the working memory. Please keep in mind that session including all facts in it is persisted and reloaded on every server restart.
Could you please try using the RuleAwareProcessEventListener as it retracts the process instance automatically when process is completed or retract the process instance manually when you don't need it any more. Before doing this remove the session id file stored in jboss_home/standalone/tmp to enforce jbpm to create new session instead of loading one that was previously persisted.
Trying it right now.
by the way in the session template, RuleAwareProcessEventLister should be registered in eventListeners section right?
I wrote it like this:
eventListeners = ["new org.jbpm.process.audit.JPAWorkingMemoryDbLogger(ksession)",
Is it correct?
I deleted all entry to the database, deleted everything in jboss_home/standalone/tmp/
and put in the RuleAwareProcessEventLister.
Then start the server again.
Still got the same null pointer exception error.
I decided to leave the rule and try other process without rule,
the process is located on different Guvnor package and this process does not have any Business Rule Task Node
Surprisingly I still got error and the Null Pointer Exception comes from the rule that is stored in different package.
So I can use my jbpm to start process again only after I delete all rules in Guvnor.
Why even rule that not related to a process still get executed?
1 of 1 people found this helpful
alright played little bit with it and what most likely is going on is that processInstance that is in the working memory is disconnected - since persistence is involved at the end of transaction process instance is disconnected which means clearing its state like ksession or process etc. So the instance of the process instance in the working memory is out dated. I managed to over come this by preloading process instance in the rule to make sure it will set it on active process instance object. please replace your rule consequence with following:
WorkflowProcessInstance p = (WorkflowProcessInstance)kcontext.getKnowledgeRuntime().getProcessInstance($processInstance.getId());
this is for the second rule as the first one is executed as part of the transaction so the process instance instance is still active.
Another thing I noticed is that the rule is triggered twice so would be good to review process and rule to confirm it work as expected, unfortunately did not have time for that
Thank you for the tips, will give that a try and post back the result.
Then, how about the rules used in other process, is it true that all rules in the guvnor will be fired regardless of what is the process being executed?
Thomas, Did you Fix it?