Discussion:
[jboss-user] [jBPM] - jbpm 5.4.0 - NullPointerException completing workItem when using Spring local transactions and shared entity manager.
J Xmith
2013-01-10 03:38:28 UTC
Permalink
J Xmith [https://community.jboss.org/people/xmithj] created the discussion

"jbpm 5.4.0 - NullPointerException completing workItem when using Spring local transactions and shared entity manager."

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

--------------------------------------------------------------
I decided to give it a try to Spring local transactions and shared entity manager, so I changed my configuration as per user guide v5.4.
I tested with a fairly simple business process with an asynchronous workItem that get completed after certain amount of time by a different thread.
Everything went well until the scheduled timer tried to complete the workItem by calling:

     ksession.getWorkItemManager().completeWorkItem(workItemId, resultMap);

By executing this line, I am getting this exception:

2013-01-10 15:13:46,234 ERROR  [Timer-0] SingleSessionCommandService M[rollbackTransaction] --> Could not commit session
java.lang.NullPointerException
    at org.jbpm.workflow.instance.node.WorkItemNodeInstance.workItemCompleted(WorkItemNodeInstance.java:306)
    at org.jbpm.workflow.instance.node.WorkItemNodeInstance.signalEvent(WorkItemNodeInstance.java:285)
    at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.signalEvent(WorkflowProcessInstanceImpl.java:342)
    at org.drools.persistence.jpa.processinstance.JPAWorkItemManager.completeWorkItem(JPAWorkItemManager.java:121)
    at org.drools.command.runtime.process.CompleteWorkItemCommand.execute(CompleteWorkItemCommand.java:69)
    at org.drools.command.runtime.process.CompleteWorkItemCommand.execute(CompleteWorkItemCommand.java:32)
    at org.drools.command.impl.DefaultCommandService.execute(DefaultCommandService.java:36)
    at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:373)
    at org.drools.command.impl.CommandBasedStatefulKnowledgeSession$1.completeWorkItem(CommandBasedStatefulKnowledgeSession.java:150)

The passed workItemId is correct (the expected one).
The same test runs successfully when configuring for JTA transaction management. Should I create a Jira issue for this?

Regards,
John
--------------------------------------------------------------

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

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Maciej Swiderski
2013-01-10 10:49:52 UTC
Permalink
Maciej Swiderski [https://community.jboss.org/people/swiderski.maciej] created the discussion

"Re: jbpm 5.4.0 - NullPointerException completing workItem when using Spring local transactions and shared entity manager."

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

--------------------------------------------------------------
could you provide your spring configuration?

it looks like the work item cannot be found in the data base...

Cheers
--------------------------------------------------------------

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

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
J Xmith
2013-01-10 23:20:50 UTC
Permalink
J Xmith [https://community.jboss.org/people/xmithj] created the discussion

"Re: jbpm 5.4.0 - NullPointerException completing workItem when using Spring local transactions and shared entity manager."

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

--------------------------------------------------------------
Thanks Maciej,

I think you will agree that if the workItem cannot be found in DB one would expect a different error rather than a misleading NullPointerException.
I believe this itself should be considered a bug. What's your view on this?

Regards,
J
--------------------------------------------------------------

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

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Maciej Swiderski
2013-01-11 11:02:32 UTC
Permalink
Maciej Swiderski [https://community.jboss.org/people/swiderski.maciej] created the discussion

"Re: jbpm 5.4.0 - NullPointerException completing workItem when using Spring local transactions and shared entity manager."

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

--------------------------------------------------------------
if it is not a result of misconfiguration I would completely agree. Anyway, if you have a reproducible test for it please file a jira issue so we could work on it.

Cheers
--------------------------------------------------------------

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

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Loading...