[jboss-user] [jBPM] - Re: Null Pointer Exception when Rule is used to change process variable value

Maciej Swiderski do-not-reply at jboss.com
Fri Dec 7 08:08:50 EST 2012


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&containerType=14&container=2034]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20121207/50558f9b/attachment-0001.html 


More information about the jboss-user mailing list