Maciej Swiderski [
https://community.jboss.org/people/swiderski.maciej] created the
discussion
"Re: Null Pointer Exception when Rule is used to change process variable value"
To view the discussion, visit:
https://community.jboss.org/message/780667#780667
--------------------------------------------------------------
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());
p.setVariable("name", "PostNewName");
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
:(
HTH
--------------------------------------------------------------
Reply to this message by going to Community
[
https://community.jboss.org/message/780667#780667]
Start a new discussion in jBPM at Community
[
https://community.jboss.org/choose-container!input.jspa?contentType=1&...]