hi, i tried to undeploy a workflow using 'undeploy definition<definitionid>' and it shows the following error message:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-06-2017 10:49 AM
org.apache.ibatis.exceptions.PersistenceException: ### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: update or delete on table "act_re_procdef" violates foreign key constraint "act_fk_exe_procdef" on table "act_ru_execution" Detail: Key (id_)=(fredy1:1:2112) is still referenced from table "act_ru_execution". ### The error may involve org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity.deleteProcessDefinitionsByDeploymentId-Inline ### The error occurred while setting parameters ### SQL: delete from ACT_RE_PROCDEF where DEPLOYMENT_ID_ = ? ### Cause: org.postgresql.util.PSQLException: ERROR: update or delete on table "act_re_procdef" violates foreign key constraint "act_fk_exe_procdef" on table "act_ru_execution" Detail: Key (id_)=(fredy1:1:2112) is still referenced from table "act_ru_execution". at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30) at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:172) at org.apache.ibatis.session.defaults.DefaultSqlSession.delete(DefaultSqlSession.java:185) at org.activiti.engine.impl.db.DbSqlSession$BulkDeleteOperation.execute(DbSqlSession.java:249) at org.activiti.engine.impl.db.DbSqlSession.flushRegularDeletes(DbSqlSession.java:924) at org.activiti.engine.impl.db.DbSqlSession.flushDeletes(DbSqlSession.java:890) at org.activiti.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:615) at org.activiti.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:212) at org.activiti.engine.impl.interceptor.CommandContext.close(CommandContext.java:138) at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:66) at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:47) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:131) 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.deleteDeployment(RepositoryServiceImpl.java:82) at org.alfresco.repo.workflow.activiti.ActivitiWorkflowEngine.undeployDefinition(ActivitiWorkflowEngine.java:1167) at org.alfresco.repo.workflow.WorkflowServiceImpl.undeployDefinition(WorkflowServiceImpl.java:308) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) at org.alfresco.service.cmr.workflow.WorkflowPermissionInterceptor.invoke(WorkflowPermissionInterceptor.java:64) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:53) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.alfresco.repo.audit.AuditMethodInterceptor.proceedWithAudit(AuditMethodInterceptor.java:256) at org.alfresco.repo.audit.AuditMethodInterceptor.proceed(AuditMethodInterceptor.java:216) at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:171) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at com.sun.proxy.$Proxy94.undeployDefinition(Unknown Source) at org.alfresco.repo.workflow.WorkflowInterpreter.executeCommand(WorkflowInterpreter.java:754) at org.alfresco.repo.admin.BaseInterpreter$1$1.execute(BaseInterpreter.java:162) at org.alfresco.repo.admin.BaseInterpreter$1$1.execute(BaseInterpreter.java:1) at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:464) at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:333) at org.alfresco.repo.admin.BaseInterpreter$1.doWork(BaseInterpreter.java:165) at org.alfresco.repo.admin.BaseInterpreter$1.doWork(BaseInterpreter.java:1) at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:555) at org.alfresco.repo.admin.BaseInterpreter.interpretCommand(BaseInterpreter.java:154) at org.alfresco.repo.web.scripts.admin.DynamicInterpreterExtension.interpretCommand(DynamicInterpreterExtension.java:111) at org.alfresco.repo.web.scripts.admin.DynamicInterpreterExtension.executeCmd(DynamicInterpreterExtension.java:74) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:126) at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:225) at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:32) at org.mozilla.javascript.gen.classpath__alfresco_templates_webscripts_org_alfresco_repository_admin_consoles_admin_workflowconsole_post_js_38._c_main_8(classpath*:alfresco/templates/webscripts/org/alfresco/repository/admin/consoles/admin-workflowconsole.post.js:191) at org.mozilla.javascript.gen.classpath__alfresco_templates_webscripts_org_alfresco_repository_admin_consoles_admin_workflowconsole_post_js_38.call(classpath*:alfresco/templates/webscripts/org/alfresco/repository/admin/consoles/admin-workflowconsole.post.js) at org.mozilla.javascript.optimizer.OptRuntime.callName0(OptRuntime.java:74) at org.mozilla.javascript.gen.classpath__alfresco_templates_webscripts_org_alfresco_repository_admin_consoles_admin_workflowconsole_post_js_38._c_script_0(classpath*:alfresco/templates/webscripts/org/alfresco/repository/admin/consoles/admin-workflowconsole.post.js:199) at org.mozilla.javascript.gen.classpath__alfresco_templates_webscripts_org_alfresco_repository_admin_consoles_admin_workflowconsole_post_js_38.call(classpath*:alfresco/templates/webscripts/org/alfresco/repository/admin/consoles/admin-workflowconsole.post.js) at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394) at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3091) at org.mozilla.javascript.gen.classpath__alfresco_templates_webscripts_org_alfresco_repository_admin_consoles_admin_workflowconsole_post_js_38.call(classpath*:alfresco/templates/webscripts/org/alfresco/repository/admin/consoles/admin-workflowconsole.post.js) at org.mozilla.javascript.gen.classpath__alfresco_templates_webscripts_org_alfresco_repository_admin_consoles_admin_workflowconsole_post_js_38.exec(classpath*:alfresco/templates/webscripts/org/alfresco/repository/admin/consoles/admin-workflowconsole.post.js) at org.alfresco.repo.jscript.RhinoScriptProcessor.executeScriptImpl(RhinoScriptProcessor.java:509) at org.alfresco.repo.jscript.RhinoScriptProcessor.execute(RhinoScriptProcessor.java:207) at org.alfresco.repo.processor.ScriptServiceImpl.execute(ScriptServiceImpl.java:219) at org.alfresco.repo.processor.ScriptServiceImpl.executeScript(ScriptServiceImpl.java:181) at org.alfresco.repo.web.scripts.RepositoryScriptProcessor.executeScript(RepositoryScriptProcessor.java:109) at org.springframework.extensions.webscripts.AbstractWebScript.executeScript(AbstractWebScript.java:1376) at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:86) at org.alfresco.repo.web.scripts.RepositoryContainer$3.execute(RepositoryContainer.java:519) at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:464) at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:587) at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:656) at org.alfresco.repo.web.scripts.RepositoryContainer.executeScriptInternal(RepositoryContainer.java:428) at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:308) at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:399) at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:210) at org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:132) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.alfresco.module.aosmodule.service.ContextRootFilter.doFilter(ContextRootFilter.java:93) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.springframework.extensions.webscripts.servlet.CSRFFilter.doFilter(CSRFFilter.java:315) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:68) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1074) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611) at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2466) at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2455) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Unknown Source) Caused by: org.postgresql.util.PSQLException: ERROR: update or delete on table "act_re_procdef" violates foreign key constraint "act_fk_exe_procdef" on table "act_ru_execution" Detail: Key (id_)=(fredy1:1:2112) is still referenced from table "act_ru_execution". at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2458) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2158) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:291) at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:432) at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:358) at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:171) at org.postgresql.jdbc.PgPreparedStatement.execute(PgPreparedStatement.java:160) at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:172) at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:172) at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:172) at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:45) at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:73) at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:49) at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:115) at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:75) at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:170) ... 112 more
- Labels:
-
Alfresco Content Services
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-06-2017 02:16 PM
Well, it seems you still have some instances of that workflow being executed.
If you want to undeploy it, you need to delete the workflow instances before.
You can do this with the following command:
delete all workflows imeanit
But be careful with it, as it will delete ALL the instances, for ALL the process definitions.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-06-2017 03:05 PM
is there a way to delete only the instances of a certain workflow, not all of them?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-08-2017 09:09 PM
You can execute the following commands:
use definition [<workflowDefId>]
This will make the specif definition the "current" one
Then you can use this to list all the instances for the current process definition:
show workflows
And finally, using the instances IDs, you can execute:
delete workflow <workflowId>
