[jboss-user] [jBPM] - Re: A question about rule task in jBPM5

dalgwen do-not-reply at jboss.com
Thu Jul 21 11:51:24 EDT 2011


dalgwen [http://community.jboss.org/people/dalgwen] created the discussion

"Re: A question about rule task in jBPM5"

To view the discussion, visit: http://community.jboss.org/message/616747#616747

--------------------------------------------------------------
Hello,

Did you get to manage your issue?
I got exactly the same stack trace, with the same situation (call to completeWorkItem() from a different thread, and with JPA persistence). Don't know if is of some value, but the code of my WorkItemHandler looks like this :


@Override
public void executeWorkItem(final WorkItem workItem, final WorkItemManager manager) {
 
 
new Thread(new Runnable() {
public void run() {
 
try {
//some code (...)
manager.completeWorkItem(workItem.getId(), null);
}
catch (Exception ex) {
// some code (...)
}
}
}).start();
 
}


Curious fact : this error is triggerered in the second WorkItemHandler of my workflow, despite the fact that the first one use the same kind of code.
When I debug, i see that :

PersistenceContext context = ((PersistenceContextManager) env.get( EnvironmentName.PERSISTENCE_CONTEXT_MANAGER )).getCommandScopedPersistenceContext();
context.persist( workItemInfo );
 
((WorkItemImpl) workItem).setId(workItemInfo.getId());


"workitemInfo" is ok, but its id is null, so the nullPointerException.

I also debugged with the first WorkItem of my workflow, and then the id is ok after the context.persist(...) call.
Don't know why it works the first time and not after.

Thanks for reading me.

(Sorry for my english, it's not my mother langage ;-) !)
--------------------------------------------------------------

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

Start a new discussion in jBPM at Community
[http://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/20110721/fc2e2ec8/attachment-0001.html 


More information about the jboss-user mailing list