[jboss-user] [jBPM] - Re: getProcess in ProcessInstanceImpl throws a NullPointerException

Marco Rietveld do-not-reply at jboss.com
Thu Apr 4 15:42:53 EDT 2013


Marco Rietveld [https://community.jboss.org/people/marco.rietveld] created the discussion

"Re: getProcess in ProcessInstanceImpl throws a NullPointerException"

To view the discussion, visit: https://community.jboss.org/message/806565#806565

--------------------------------------------------------------
h4. What's probably happening is that the code you're calling is happening outside of a transaction. 

You've posted the code above, so you can see that the NPE is probably happening because the ProcessInstanceImpl.kruntime field is null. 

The kruntime field in the ProcessInstanceImpl is set to null as soon as the transaction is closed. This has to do with making sure that jBPM doesn't cache old copies of processinstances. 

So, in this case, when you call 
wpi.getNodeInstances()
the transaction has already ended (it ended within the ksession.getProcessInstance() method). 

May I ask why you want a list of NodeInstances? There may be other ways to get the information that you're looking for. Also, at the moment that you're looking for the node instances, there shouldn't be any or otherwise you're betting on a race condition. 


--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/806565#806565]

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/20130404/22d11c81/attachment.html 


More information about the jboss-user mailing list