cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot end task/delete workflow using console

devodl
Champ in-the-making
Champ in-the-making
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 moreCaused 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 moreCaused 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 more2012-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‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
5 REPLIES 5

jpotts
World-Class Innovator
World-Class Innovator
Have you tried using the workflow console to set a value for the missing variable? Assuming you have already done a "use workflow" command, you should be able to set it with something like "var bpm_siteShortName='foo'".

You could also try doing an "end workflow".

Jeff

devodl
Champ in-the-making
Champ in-the-making
Jeff,
Thanks for the response, it got my hopes up but the Workflow process/Task is still hung.

I logged into the workflow console as admin and issued the following commands:
user sdeal
using user sdeal

show my tasks
sdeal:
id: activiti$10278 , name: wf:approvedParallelTask , properties: 21 , workflow: activiti$10130 , path: activiti$10130

use workflow activiti$10130
definition: activiti$alfParallelReview-Lifecycle:1:6990 , name: ALF Parallel Review with Lifecycle , version: 1
workflow: activiti$10130 , active: true
path: activiti$10130 , node: Document Approved

var bpm:siteShortName='dsprojectdemosite'
set var {http://www.alfresco.org/model/bpm/1.0}siteShortName = 'dsprojectdemosite'

end task activiti$10278
org.alfresco.scripts.ScriptException: 021958052 Failed to execute supplied script: 021958051 ReferenceError: "bpm_siteShortName" is not defined. (AlfrescoJS#2)

I know that this is due to my hastily/poorly written Listener Javascript in the workflow
/* Move to Final Review folder */if (bpm_siteShortName != undefined && bpm_finalReview != undefined){  var destPath = "/Sites/" + bpm_siteShortName + "/documentLibrary/" + bpm_finalReview;  var destNode = companyhome.childByNamePath(destPath);  for (var i = 0; i < bpm_package.children.length; i++)  {     bpm_package.children[i].move(destNode);  }} // end of if‍‍‍‍‍‍‍‍‍‍‍‍
But how can I get the Workflow to end?

frederikhereman
Champ in-the-making
Champ in-the-making
To prevent this error, use the following check instead of the normal '!= undefended', as done in the out-of-the-box workflow task-listeners:

if (typeof bpm_workflowDueDate != 'undefined') ‍

This will prevent future 'bpm_siteShortName" is not defined.' exception. To get the current task completed or workflow deleted, I'm afraid you'll keep bumping into the "process end listener" which tries to run the failing code (this is the way activiti is designed, to have a mechanism to run eg. cleanup-code when process ends or is deleted). What I don't get is why the exception keeps on occurring, even if the variable has been set.

Can you show all variables that are set in the workflow-path/task?

If you REALLY want the workflow to go away it will require some fiddling in the activiti-database, replacing the process-definition-id on the executions and tasks with the next version of the workflow that doesn't show this error. Although, this is imho the last resort and a bit tricky.

Cheers,
Frederik

devodl
Champ in-the-making
Champ in-the-making
Smiley Sad Sigh… I could not get the bpm_siteShortName defined in a manner that would satisfy the JavaScript for the end task so…

Against my better judgement I hacked the database directly to end the task.
Using the ID displayed in the Task Share (10278) I logged into Postgresql and issued the command:
delete from public.act_ru_task where id_ = '10278';‍
It remains to be seen if my actions have corrupted the workflow processes or the database.

Thanks to all for your advice on this matter.
Steve

tomoconnell
Champ in-the-making
Champ in-the-making
I have the same problem as devodl.

End ExecutionListener references a var that doesn't exist (due to misspelling)

I've had no luck creating or editing the vars through the workflow console. The var command works but doesn't seem to set any variables on the actual workflow.

I don't know what next steps to take in order to remove this workflow definition.