[jboss-user] [jBPM] - Re: jBPM 5.2 set process instance variable from java - NullPointerException

Salvatore Loria do-not-reply at jboss.com
Thu May 3 09:24:03 EDT 2012


Salvatore Loria [https://community.jboss.org/people/slash17] created the discussion

"Re: jBPM 5.2 set process instance variable from java - NullPointerException"

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

--------------------------------------------------------------
Thanks for the answer.

My jBPMSession is of course active....I instantiate it in in the init() method of my startup servlet and dispose it in it's destroy method.
Moreover I'm sure it's active because I can start new processes without problems.

I tried both creating it (using newStatefullKnoledgeSession) and load it from db (using loadStatefullKnoledgeSession)...nothing changes.
Moreover, I'm trying to access and modify a variable af a process just created in this session, not in a previous one, so I don't think that creating o loading it could be the problem.


Yet another code snippet to better explain my situation:

Map<String, Object> vars = new HashMap<String, Object>();
vars.put("user", "john");
ProcessInstance processInstance = jBPMSession.startProcess("MyProcess");
// the process starts correctly
WorkflowProcessInstance p = (WorkflowProcessInstance) processInstance;
System.out.println("before set: " + p.getVariable("user"));
// it works and print "bofore set: john" as you can see in the first post
p.setVariable("user", "krisv");
// this throws the NullPointerException...
--------------------------------------------------------------

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

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/20120503/3bc7f092/attachment.html 


More information about the jboss-user mailing list