AnsweredAssumed Answered

Cannot end task/delete workflow using console

Question asked by devodl on Mar 5, 2012
Latest reply on Feb 27, 2014 by tomoconnell
Sigh…
My Activiti workflow has a Listener (alfrescoScriptType) that fires at the end of the workflow.  Unfortunately my code didn't catch an exception for an unset variable (bpm_siteShortName) and now the Workflow is stuck at the last task.

When the assigned User attempts to acknowledge completion of the workflow (click on "Next") they are presented with:
Failure
org.alfresco.scripts.ScriptException: 020517090 Failed to execute supplied script: 020517089 ReferenceError: "bpm_siteShortName" is not defined. (AlfrescoJS#2)

If the User who initiated the Workflow tries to Cancel the Workflow using Share it fails as well.

Using the Workflow Console to delete the workflow with the command: delete workflow activiti$10130  produces:
org.alfresco.scripts.ScriptException: 020517117 Failed to execute supplied script: 020517116 ReferenceError: "bpm_siteShortName" is not defined. (AlfrescoJS#2)

Using the Workflow Console to end the task with the command: end task activiti$10278  produces:
org.alfresco.scripts.ScriptException: 020517113 Failed to execute supplied script: 020517112 ReferenceError: "bpm_siteShortName" is not defined. (AlfrescoJS#2)

So now I'm stumped, the task cannot end and the workflow cannot be deleted.
How do I end/delete/kill/obliterate the task and workflow without leaving orphaned debris behind?

Oh, here's the obligatory logfile…
 
2012-03-05 08:22:30,469  DEBUG [repo.jscript.RhinoScriptProcessor] [http-8080-136] Time to execute script: 15.887215ms
2012-03-05 08:22:30,511  WARN  [repo.dictionary.DictionaryDAO] [http-8080-74] Type not found: {}reviewTask
2012-03-05 08:22:30,733  DEBUG [repo.jscript.ScriptLogger] [http-8080-76] Generating form for item:
2012-03-05 08:22:30,733  DEBUG [repo.jscript.ScriptLogger] [http-8080-76]      kind = task
2012-03-05 08:22:30,733  DEBUG [repo.jscript.ScriptLogger] [http-8080-76]      id = activiti$start10130
2012-03-05 08:22:30,734  DEBUG [repo.jscript.ScriptLogger] [http-8080-76] fields = bpm:groupAssignee,wf:requiredApprovePercent,bpm:sendEMailNotifications,packageItems
2012-03-05 08:22:30,772  DEBUG [repo.jscript.ScriptLogger] [http-8080-76] formModel = {"formData": {"assoc_bpm_groupAssignee": "workspace:\/\/SpacesStore\/0e4c45c1-2b52-4d08-9afb-2f1e984f0d18", "prop_bpm_sendEMailNotifications": false, "prop_bpm_packageActionGroup": "add_package_item_actions", "assoc_packageItems": "workspace:\/\/SpacesStore\/554b092e-773f-4adf-80a0-2f83bbb32d72", "prop_wf_requiredApprovePercent": 100.0, "prop_bpm_packageItemActionGroup": "start_package_item_actions"}, "item": "api\/task-instances\/activiti$start10130", "type": "wf:submitGroupReviewTask", "submissionUrl": "\/api\/task\/activiti%24start10130\/formprocessor", "fields": "[Lorg.alfresco.repo.forms.FieldDefinition;@4b61e002"}
2012-03-05 08:22:30,772  DEBUG [repo.jscript.RhinoScriptProcessor] [http-8080-76] Time to execute script: 39.020157ms
2012-03-05 08:22:30,959  DEBUG [repo.jscript.ScriptLogger] [http-8080-98] #items = 1, #results = 0
2012-03-05 08:22:30,961  DEBUG [repo.jscript.RhinoScriptProcessor] [http-8080-98] Time to execute script: 2.574841ms
2012-03-05 08:22:30,971  DEBUG [repo.jscript.ScriptLogger] [http-8080-89] #items = 1, #results = 1
2012-03-05 08:22:30,971  DEBUG [repo.jscript.RhinoScriptProcessor] [http-8080-89] Time to execute script: 0.87479ms
2012-03-05 08:22:34,726  DEBUG [repo.jscript.RhinoScriptProcessor] [http-8080-1] Imports resolved, adding resource '_root
2012-03-05 08:22:34,731  DEBUG [repo.jscript.RhinoScriptProcessor] [http-8080-1] Time to execute script: 2.774464ms
2012-03-05 08:22:34,732  DEBUG [repo.jscript.RhinoScriptProcessor] [http-8080-1] Imports resolved, adding resource '_root
2012-03-05 08:22:34,736  DEBUG [repo.jscript.RhinoScriptProcessor] [http-8080-1] Time to execute script: 1.71909ms
2012-03-05 08:22:34,738  ERROR [extensions.webscripts.AbstractRuntime] [http-8080-1] Exception from executeScript - redirecting to status template error: 02050010 Wrapped Exception (with status template): 020517108 Failed to execute supplied script: 020517107 ReferenceError: "bpm_siteShortName" is not defined. (AlfrescoJS#2)
org.springframework.extensions.webscripts.WebScriptException: 02050010 Wrapped Exception (with status template): 020517108 Failed to execute supplied script: 020517107 ReferenceError: "bpm_siteShortName" is not defined. (AlfrescoJS#2)
        at org.springframework.extensions.webscripts.AbstractWebScript.createStatusException(AbstractWebScript.java:905)
        at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:171)
        at org.alfresco.repo.web.scripts.RepositoryContainer$2.execute(RepositoryContainer.java:400)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:388)
        at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:462)
        at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:500)
        at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:316)
        at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:372)
        at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:209)
        at org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:118)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:58)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:470)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Thread.java:619)
Caused by: org.alfresco.scripts.ScriptException: 020517108 Failed to execute supplied script: 020517107 ReferenceError: "bpm_siteShortName" is not defined. (AlfrescoJS#2)
        at org.alfresco.repo.jscript.RhinoScriptProcessor.executeString(RhinoScriptProcessor.java:271)
        at org.alfresco.repo.processor.ScriptServiceImpl.executeScriptString(ScriptServiceImpl.java:322)
        at org.alfresco.repo.processor.ScriptServiceImpl.executeScriptString(ScriptServiceImpl.java:300)
        at sun.reflect.GeneratedMethodAccessor1768.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
        at org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor.invoke(AlwaysProceedMethodInterceptor.java:34)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:44)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.alfresco.repo.audit.AuditMethodInterceptor.proceed(AuditMethodInterceptor.java:175)
        at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:152)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
        at $Proxy260.executeScriptString(Unknown Source)
        at org.alfresco.repo.workflow.activiti.script.ActivitiScriptBase.executeScript(ActivitiScriptBase.java:104)
        at org.alfresco.repo.workflow.activiti.script.ActivitiScriptBase.executeScript(ActivitiScriptBase.java:62)
        at org.alfresco.repo.workflow.activiti.script.DelegateExecutionScriptBase.runScript(DelegateExecutionScriptBase.java:70)
        at org.alfresco.repo.workflow.activiti.listener.ScriptExecutionListener.notify(ScriptExecutionListener.java:52)
        at org.activiti.engine.impl.delegate.ExecutionListenerInvocation.invoke(ExecutionListenerInvocation.java:34)
        at org.activiti.engine.impl.delegate.DelegateInvocation.proceed(DelegateInvocation.java:37)
        at org.activiti.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocation(DefaultDelegateInterceptor.java:25)
        at org.activiti.engine.impl.bpmn.helper.ClassDelegate.notify(ClassDelegate.java:68)
        at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:38)
        at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:76)
        at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:481)
        at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:45)
        at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:76)
        at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:481)
        at org.activiti.engine.impl.pvm.runtime.AtomicOperationDeleteCascadeFireActivityEnd.eventNotificationsCompleted(AtomicOperationDeleteCascadeFireActivityEnd.java:54)
        at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:52)
        at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:76)
        at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:481)
        at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:45)
        at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:76)
        at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:481)
        at org.activiti.engine.impl.pvm.runtime.AtomicOperationDeleteCascade.execute(AtomicOperationDeleteCascade.java:31)
        at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:76)
        at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:481)
        at org.activiti.engine.impl.persistence.entity.ExecutionEntity.deleteCascade(ExecutionEntity.java:930)
        at org.activiti.engine.impl.persistence.entity.ExecutionManager.deleteProcessInstance(ExecutionManager.java:70)
        at org.activiti.engine.impl.persistence.entity.ExecutionManager.deleteProcessInstance(ExecutionManager.java:49)
        at org.activiti.engine.impl.cmd.DeleteProcessInstanceCmd.execute(DeleteProcessInstanceCmd.java:41)
        at org.activiti.engine.impl.cmd.DeleteProcessInstanceCmd.execute(DeleteProcessInstanceCmd.java:25)
        at org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
        at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:42)
        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:33)
        at org.activiti.engine.impl.RuntimeServiceImpl.deleteProcessInstance(RuntimeServiceImpl.java:73)
        at org.alfresco.repo.workflow.activiti.ActivitiWorkflowEngine.cancelWorkflow(ActivitiWorkflowEngine.java:240)
        at org.alfresco.repo.workflow.WorkflowServiceImpl.cancelWorkflow(WorkflowServiceImpl.java:557)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
        at org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor.invoke(AlwaysProceedMethodInterceptor.java:34)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:44)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.alfresco.repo.audit.AuditMethodInterceptor.proceedWithAudit(AuditMethodInterceptor.java:232)
        at org.alfresco.repo.audit.AuditMethodInterceptor.proceed(AuditMethodInterceptor.java:199)
        at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:152)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
        at $Proxy70.cancelWorkflow(Unknown Source)
        at org.alfresco.repo.web.scripts.workflow.WorkflowInstanceDelete.buildModel(WorkflowInstanceDelete.java:62)
        at org.alfresco.repo.web.scripts.workflow.AbstractWorkflowWebscript.executeImpl(AbstractWorkflowWebscript.java:80)
        at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:64)
        … 25 more
Caused by: org.alfresco.error.AlfrescoRuntimeException: 020517107 ReferenceError: "bpm_siteShortName" is not defined. (AlfrescoJS#2)
        at org.alfresco.repo.jscript.RhinoScriptProcessor.executeScriptImpl(RhinoScriptProcessor.java:499)
        at org.alfresco.repo.jscript.RhinoScriptProcessor.executeString(RhinoScriptProcessor.java:267)
        … 104 more
Caused by: org.mozilla.javascript.EcmaError: ReferenceError: "bpm_siteShortName" is not defined. (AlfrescoJS#2)
        at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3350)
        at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3340)
        at org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3413)
        at org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1612)
        at org.mozilla.javascript.gen.c177._c0(AlfrescoJS:2)
        at org.mozilla.javascript.gen.c177.call(AlfrescoJS)
        at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)
        at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2834)
        at org.mozilla.javascript.gen.c177.call(AlfrescoJS)
        at org.mozilla.javascript.gen.c177.exec(AlfrescoJS)
        at org.alfresco.repo.jscript.RhinoScriptProcessor.executeScriptImpl(RhinoScriptProcessor.java:483)
        … 105 more
2012-03-05 08:24:08,485  DEBUG [repo.jscript.RhinoScriptProcessor] [http-8080-89] Imports resolved, adding resource '_root
2012-03-05 08:24:08,490  DEBUG [repo.jscript.RhinoScriptProcessor] [http-8080-89] Time to execute script: 2.561518ms

Outcomes