Deleted workflow being read from history task!

cancel
Showing results for 
Search instead for 
Did you mean: 
khushbu
Active Member

Deleted workflow being read from history task!

Jump to solution

Hello,
In ACS I have created a workflow definition & created some workflows based on that.
Later I have to update the workflow Id of the workflow definition. After deploying the new workflow Id I have undeployed the old workflow Id from the workflow console using the command: 

undeploy definition name <workflowName>

The definition was undeployed successfully but now I'm not able to access the completed task page because the following API call is getting failed in ACS:

http://localhost:8080/alfresco/service/api/task-instances?authority=username&properties=bpm_priority,bpm_status,bpm_startDate,bpm_dueDate,bpm_description&exclude=wcmwf:*&pooledTasks=false&state=COMPLETED&skipCount=0&maxItems=25

Error:

org.activiti.engine.ActivitiObjectNotFoundException: no deployed process definition found with id 'old-workflow-definition'
       |  at org.activiti.engine.impl.persistence.deploy.DeploymentManager.findDeployedProcessDefinitionById(DeploymentManager.java:75)
       |  at org.activiti.engine.impl.cmd.GetDeploymentProcessDefinitionCmd.execute(GetDeploymentProcessDefinitionCmd.java:39)
       |  at org.activiti.engine.impl.cmd.GetDeploymentProcessDefinitionCmd.execute(GetDeploymentProcessDefinitionCmd.java:26)
       |  at org.activiti.engine.impl.interceptor.CommandInvoker.execute(CommandInvoker.java:24)
       |  at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:57)
       |  at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:47)
       |  at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
       |  at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:45)
       |  at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:31)
       |  at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:40)
       |  at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:35)
       |  at org.activiti.engine.impl.RepositoryServiceImpl.getDeployedProcessDefinition(RepositoryServiceImpl.java:139)
       |  at org.alfresco.repo.workflow.activiti.ActivitiUtil.getDeployedProcessDefinition(ActivitiUtil.java:146)
       |  at org.alfresco.repo.workflow.activiti.ActivitiTypeConverter.getTaskDefinition(ActivitiTypeConverter.java:223)
       |  at org.alfresco.service.cmr.workflow.LazyActivitiWorkflowTask.<init>(LazyActivitiWorkflowTask.java:93)
       |  at org.alfresco.repo.workflow.activiti.ActivitiWorkflowEngine.getAssignedTasks(ActivitiWorkflowEngine.java:1546)
       |  at org.alfresco.repo.workflow.WorkflowServiceImpl.getAssignedTasks(WorkflowServiceImpl.java:843)
       |  at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       |  at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
       |  at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
...
...
       | Caused by: org.alfresco.service.cmr.workflow.WorkflowException: 11030046 Failed to retrieve tasks assigned to authority {0} in state {1}.
       |  at org.alfresco.repo.workflow.activiti.ActivitiWorkflowEngine.getAssignedTasks(ActivitiWorkflowEngine.java:1563)
       |  at org.alfresco.repo.workflow.WorkflowServiceImpl.getAssignedTasks(WorkflowServiceImpl.java:843)
       |  at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       |  at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
       |  at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
       |  at java.base/java.lang.reflect.Method.invoke(Method.java:566)
       |  at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
       |  at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
       |  at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
       |  at org.alfresco.service.cmr.workflow.WorkflowPermissionInterceptor.invoke(WorkflowPermissionInterceptor.java:64)
       |  at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
       |  at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:53)
       |  at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
       |  at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:166)
       |  at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
       |  at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:366)
       |  at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:118)
       |  at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
       |  at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)
       |  at com.sun.proxy.$Proxy80.getAssignedTasks(Unknown Source)
       |  at org.alfresco.repo.web.scripts.workflow.TaskInstancesGet.buildModel(TaskInstancesGet.java:145)
       |  at org.alfresco.repo.web.scripts.workflow.AbstractWorkflowWebscript.executeImpl(AbstractWorkflowWebscript.java:88)
       |  at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:64)
       |  ... 111 more
       | Caused by: org.activiti.engine.ActivitiObjectNotFoundException: no deployed process definition found with id 'old-workflow-definition'
...
...


I have already tried to delete completed workflows based on the old-workflow-definition-id from workflow-console, web scripts & API-explorer but nothing worked! Since the workflow definition is already undeployed & doesn't exist anymore in my local ACS!

Please guide or suggest me how can I delete all the completed workflows of an old-workflow-definition, so that the API call of getting all the completed workflow doesn't fail?

1 Solution

Accepted Solutions
afaust
Master

Re: Deleted workflow being read from history task!

Jump to solution

One way I could see yourself dig yourself out of the hole would be to redeploy the workflow, then perform a DB update on all active / historic processes with the old definition ID to reference the new definition ID. Then you should be able to delete all workflows properly, and undeploy the definition again.

View solution in original post

3 Replies
afaust
Master

Re: Deleted workflow being read from history task!

Jump to solution

One way I could see yourself dig yourself out of the hole would be to redeploy the workflow, then perform a DB update on all active / historic processes with the old definition ID to reference the new definition ID. Then you should be able to delete all workflows properly, and undeploy the definition again.

khushbu
Active Member

Re: Deleted workflow being read from history task!

Jump to solution

old-workflow-definition-id was already undeployed so even if I deploy it again the version was different than the specified in the error, so that's why the API was still not working. Because I think the same version can't be redeployed again.
As you suggested I have made the changes directly into the database.
Removed the history of tasks, identity links & processes of old-workflow-definition-id. Then the API worked fine!

Thank you for your suggestion afaust.

upforsin
Senior Member

Re: Deleted workflow being read from history task!

Jump to solution

If anyone would be still interested, there is a script fixing this issue:

https://gist.github.com/howkymike/e6678117083e6021a112ba4b9897da73

howkymike
Alfresco Developer