Dino Antonelli [
https://community.jboss.org/people/dino.antonelli] created the discussion
"Re: Unable to complete a task when running the task in a separate thread"
To view the discussion, visit:
https://community.jboss.org/message/739390#739390
--------------------------------------------------------------
Hi Kris,
I've the same problem as Connie. I've a different thread that is running the
handler and I'm also experiencing the above NullPointerException during the its
execution. I've passed, as you suggested, the ksession to the handler so I call
"ksession.getWorkItemManager().completeWorkItem" to complete the execution.
Anyway I'm getting the exception very frequently. I've read that there must be a
transaction to have a successful complete but it seems that the thread that makes the call
always run inside a transaction; below my snippet of code:
TransactionManager tm = TransactionManagerLocator.getInstance().locate();
boolean transactionStarted = false;
if(tm.getStatus() == Status.STATUS_NO_TRANSACTION) {
transactionStarted = true;
tm.begin();
}
this.ksession.getWorkItemManager().completeWorkItem(wi.getId(), inputParameters);
if(transactionStarted) {
tm.commit();
}
It seems that I've never execute the begin because thre's always an active
transaction.
Have you any idea?
thnks in advance
Dino
--------------------------------------------------------------
Reply to this message by going to Community
[
https://community.jboss.org/message/739390#739390]
Start a new discussion in jBPM at Community
[
https://community.jboss.org/choose-container!input.jspa?contentType=1&...]