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]

_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to