does using loadProcessInstanceForUpdate help? Otherwise I have no idea
I tried the method suggested and this didn't help.
If I leave the close out of the code the program functions correctly, but I don't see an end date in the jbpm_taskinstance table so I assume that the persistence occurs on the close.
If I obtain the current context into the code before my close I can see that there are 2 contexts above mine in the stack.
I tried to close them both and this then allows the code to function but on leaving the program I then get all sorts of session closed errors.
I forgot to add that this running within an EJB session bean, so I don't know if that has any bearing on the matter.
Hope you can assist
Can you post the full exception stack trace? Your problem is probably related to JBPM-1130 but it is hard to tell without the trace.
if it is running within an ejb, then probably what you can try is removing te close from your code but add a save
Looking at the JBPM code (3.3.1GA), it seams that in JbpmConfiguration.java there is a singletion Stack that is used to push and pop JbpmContext. If you have multi-thread in your application (including time and async job), the JbpmContext cannot be pushed and poped in the right order.
You can take a look at JbpmConfiguration.java for methods pushJbpmContext() and popJbpmContext() for detail.
the contexts are threadlocals.... Timers (the jobexecutor) has it's own context, as do the async jobs... so that has nothing to do with it afaik.... I've never had problems running jBPM with multiple parallel requests. The only situation where I got this error was when I closed and opened the context in the wrong order.... so EBKAC