cancel
Showing results for 
Search instead for 
Did you mean: 

Error on Process Migration

jatz
Champ in-the-making
Champ in-the-making
With Activiti 5.11 we are seeing an error show up on our system during migration.

The migration is for our older existing processes to be migrated to the new updated ones using the SetProcessDefinitionVersionCmd.

The scenario is that we have a simple user task in our first flow. After this gets deployed a change is done where a timer is attached to the user task and redeployed again.

But any process with the older task which gets migrated throws the below exception when trying to complete the user task:

java.lang.NullPointerException
   at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionDestroyScope.execute(AtomicOperationTransitionDestroyScope.java:95)
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:85)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:535)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:530)
   at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerEnd.eventNotificationsCompleted(AtomicOperationTransitionNotifyListenerEnd.java:36)
   at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:56)
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:85)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:535)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:530)
   at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:49)
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:85)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:535)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:530)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.take(ExecutionEntity.java:370)
   at org.activiti.engine.impl.bpmn.behavior.BpmnActivityBehavior.performOutgoingBehavior(BpmnActivityBehavior.java:102)
   at org.activiti.engine.impl.bpmn.behavior.BpmnActivityBehavior.performDefaultOutgoingBehavior(BpmnActivityBehavior.java:51)
   at org.activiti.engine.impl.bpmn.behavior.FlowNodeActivityBehavior.leave(FlowNodeActivityBehavior.java:44)
   at org.activiti.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior.leave(AbstractBpmnActivityBehavior.java:47)
   at org.activiti.engine.impl.bpmn.behavior.UserTaskActivityBehavior.signal(UserTaskActivityBehavior.java:98)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.signal(ExecutionEntity.java:353)
   at org.activiti.engine.impl.persistence.entity.TaskEntity.complete(TaskEntity.java:157)
   at org.activiti.engine.impl.cmd.CompleteTaskCmd.execute(CompleteTaskCmd.java:39)
   at org.activiti.engine.impl.cmd.CompleteTaskCmd.execute(CompleteTaskCmd.java:24)
   at org.activiti.engine.impl.cmd.NeedsActiveTaskCmd.execute(NeedsActiveTaskCmd.java:58)
   at org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
   at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:60)
   at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:42)
   at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
   at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:40)
   at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:32)
   at org.activiti.engine.impl.TaskServiceImpl.complete(TaskServiceImpl.java:157)
   

How do we make sure that the above does not happen?

I have attached the files - one Unit test, and the older and newer migrated flow.
4 REPLIES 4

jatz
Champ in-the-making
Champ in-the-making
Another migration question for the SetProcessDefinitionVersionCmd - is it possible to add an execution listener for an end event if a process is already running with an older definition? The newer definition has this listener but we want to make the older ones also have this listener.

If not, is there a way to do this? Or will it have to be some migration which will involve closing the older processes and creating new ones?

frederikherema1
Star Contributor
Star Contributor
Adding a boundary-event to a tasks implicit ally creates a scope around it. So all processes that are running in the old-version and are waiting in the task that has a boundary-event in the new version, won't work. There is no workaround for this, as the scope is created when the task is created. Only thing you can do is, in your new process, have a user-task without a boundary-event and an identical user task with the boundary-event after it. After changing version, complete all those tasks to force to move into the "userTaskWIthBoundary". Finally, you can deploy yet another version of the definition (without the duplicate users task, only the "userTaskWIthBoundary" remains) to make sure new processes don't have the "two user tasks" hack in them.

It's possible to add an execution-listener to the new process-defintion. When the process ends, the listeners are fetched from the process-definition attached -> which is the new version.

jatz
Champ in-the-making
Champ in-the-making
The idea helped. I had to migrate to the User task (without timers) then complete each of them to the state with Timers on it. It's a bit lengthy as I need to maintain two versions - intermediate and new, but I am assuming this will only be needed if there are new timer boundaries to migrate.

frederikherema1
Star Contributor
Star Contributor
Yes, that's indeed the case (timers or other boundary-events attached).