`

org.activiti.engine.ActivitiObjectNotFoundException: no deployed process definit

阅读更多

原文链接:http://www.hxstrive.com/article/125.htm

 

 

今天开始学习Activiti,在搭建环境的时候出现了很多错误。其他问题都解决了,唯独下面这个问题纠结了很久。还好最后还是解决了。

 

错误信息:

70 [main] INFO org.activiti.engine.ProcessEngines - Initializing process engine using configuration 'file:/F:/Project_All/Eclipase_Workspace/Activiti_test01/bin/activiti.cfg.xml'

89 [main] INFO org.activiti.engine.ProcessEngines - initializing process engine for resource file:/F:/Project_All/Eclipase_Workspace/Activiti_test01/bin/activiti.cfg.xml

2015-2-14 9:07:16 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions

信息: Loading XML bean definitions from resource loaded through InputStream

17767 [main] INFO org.activiti.engine.impl.ProcessEngineImpl - ProcessEngine default created

17767 [main] INFO org.activiti.engine.impl.jobexecutor.JobExecutor - Starting up the JobExecutor[org.activiti.engine.impl.jobexecutor.DefaultJobExecutor].

17818 [main] INFO org.activiti.engine.ProcessEngines - initialised process engine default

17819 [Thread-1] INFO org.activiti.engine.impl.jobexecutor.AcquireJobsRunnable - JobExecutor[org.activiti.engine.impl.jobexecutor.DefaultJobExecutor] starting to acquire jobs

18204 [main] INFO org.activiti.engine.impl.bpmn.deployer.BpmnDeployer - Processing resource bpmn/activiti_test01.bpmn20.xml

21012 [main] ERROR org.activiti.engine.impl.interceptor.CommandContext - Error while closing command context

org.activiti.engine.ActivitiObjectNotFoundException: no deployed process definition found with id 'simpleApprovalProcess'

at org.activiti.engine.impl.persistence.deploy.DeploymentManager.findDeployedProcessDefinitionById(DeploymentManager.java:55)

at org.activiti.engine.impl.cmd.StartProcessInstanceCmd.execute(StartProcessInstanceCmd.java:59)

at org.activiti.engine.impl.cmd.StartProcessInstanceCmd.execute(StartProcessInstanceCmd.java:36)

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.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.RuntimeServiceImpl.startProcessInstanceById(RuntimeServiceImpl.java:72)

at com.bug315.ActivitiTest01.main(ActivitiTest01.java:22)

Exception in thread "main" org.activiti.engine.ActivitiObjectNotFoundException: no deployed process definition found with id 'simpleApprovalProcess'

at org.activiti.engine.impl.persistence.deploy.DeploymentManager.findDeployedProcessDefinitionById(DeploymentManager.java:55)

at org.activiti.engine.impl.cmd.StartProcessInstanceCmd.execute(StartProcessInstanceCmd.java:59)

at org.activiti.engine.impl.cmd.StartProcessInstanceCmd.execute(StartProcessInstanceCmd.java:36)

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.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.RuntimeServiceImpl.startProcessInstanceById(RuntimeServiceImpl.java:72)

at com.bug315.ActivitiTest01.main(ActivitiTest01.java:22)

 

我的Java代码:

package com.bug315;

 

import org.activiti.engine.ProcessEngine;

import org.activiti.engine.ProcessEngines;

import org.activiti.engine.RepositoryService;

import org.activiti.engine.RuntimeService;

import org.activiti.engine.TaskService;

import org.activiti.engine.runtime.ProcessInstance;

import org.activiti.engine.task.Task;

 

public class ActivitiTest01 {

 

    public static void main(String[] args) {

        // 创建流程引擎

        ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();

         

        // 获取流程存储服务组件

        RepositoryService repositoryService = processEngine.getRepositoryService();

         

        // 获取运行时服务组件

        RuntimeService runtimeService = processEngine.getRuntimeService();

         

        // 获取流程任务组件

        TaskService taskService = processEngine.getTaskService();

         

        // 1、部署流程文件

        repositoryService.createDeployment().name("myProcess")

            .addClasspathResource("bpmn/activiti_test01.bpmn").deploy();

         

        // 2、启动流程

        ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("myProcess"); 

                //runtimeService.startProcessInstanceById("myProcess");

        System.out.println(processInstance.getId());

         

        // 3、查询第一个任务

        Task task = taskService.createTaskQuery().singleResult();

        System.out.println("============" + task.getId() + "============");

        taskService.complete(task.getId()); // 完成任务

         

        // 4、查询第二个任务

        task = taskService.createTaskQuery().singleResult();

        System.out.println("============" + task.getId() + "============");

        taskService.complete(task.getId()); // 完成任务

         

        // 5、流程结束

        task = taskService.createTaskQuery().singleResult();

        System.out.println("============ 任务结束(" + task + ") ============");

    }

     

}

 

解决办法:

    仔细看上面的异常是指定的流程定义ID不存在。再仔细看看我的代码,我的愿意是通过流程定义中<process>元素的id去启动流程。但是我错误写使用了startProcessInstanceById方法。因此将startProcessInstanceById()方法改为startProcessInstanceByKey()方法就解决问题了。你到act_re_procdef表中去查看ID_字段的格式为:myProcess:1:4,所以根本就不存在ID等于myProcess的流程定义。这些都是初心大意造成的,不知你是否也犯过这种低级错误。

 

部分流程XML代码:

<process id="myProcess" name="My process" isExecutable="true">

 

部分测试代码:

// 2、启动流程

ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("myProcess"); 

// runtimeService.startProcessInstanceById("myProcess"); // 这里调用方法写错了

 

原文链接:http://www.hxstrive.com/article/125.htm

分享到:
评论

相关推荐

    Activiti发布流程报错org.activiti.engine.ActivitiException: Error parsing XML

    郁闷啊,有时候不得不承认,无论是什么事,曾经是好的,到后边未必还是好的,不要拿曾经的种种来判断今天的结果, 前景:之前本地用jeecg(1.7版本)设计流程、发布流程、修改流程,所有的操作都是项目有汉字启动的,...

    activiti-engine-5.22.0.jar

    替换原有activiti-engine-5.22.0.jar包,目前测试支持gbase8s、gbase8a。maven工程,需要将该jar包放到自己的私服上,另起目录位置。如果没有私服,可以下载开源jar包后,手动替换jar包

    工作流引擎(activiti)JAR包

    1. activiti-engine.jar:包含了Activiti引擎的核心实现,用于执行流程实例。 2. spring-context.jar、spring-beans.jar等:Spring框架的核心库,负责依赖注入和应用上下文管理。 3. mysql-connector-java.jar:...

    activiti-engine-5.21.0-API文档-中文版.zip

    Maven坐标:org.activiti:activiti-engine:5.21.0; 标签:activiti、engine、中文文档、jar包、java; 使用方法:解压翻译后的API文档,用浏览器打开“index.html”文件,即可纵览文档内容。 人性化翻译,文档中的...

    activiti-process-validation-5.21.0.jar

    &lt;!-- https://mvnrepository.com/artifact/org.activiti/activiti-engine --&gt; &lt;groupId&gt;org.activiti &lt;artifactId&gt;activiti-engine &lt;version&gt;5.21.0 &lt;/dependency&gt;

    eclipse安装activiti报错(requires 'org.eclipse.emf 2.6.0' but it could not be found)

    Software being installed: Activiti Eclipse BPMN 2.0 Designer 5.18.0.201508100929 (org.activiti.designer.feature.feature.group 5.18.0.201508100929) Missing requirement: Activiti Eclipse BPMN 2.0 ...

    eclipse Activiti 插件 jar包 出错

    org.activiti.designer.kickstart.gui.process org.activiti.designer.kickstart.util org.activiti.designer.libs org.activiti.designer.util org.activiti.designer.validation.bpmn org.eclipse.graphiti.mm org...

    eclipse安装Activiti-designer 所需jar包

    Missing requirement: Activiti Eclipse BPMN 2.0 Designer 5.18.0.201508100929 (org.activiti.designer.feature.feature.group 5.18.0.201508100929) requires 'org.eclipse.emf.transaction 1.4.0' but it could...

    eclipse-emf for activity

    An error occurred while collecting items to be installed...Unable to read repository at http://activiti.org/designer/update/plugins/org.activiti.designer.libs_5.18.0.201508100929.jar. 问题解决需要的jar包

    activiti-process-validation-5.21.0-API文档-中文版.zip

    Maven坐标:org.activiti:activiti-process-validation:5.21.0; 标签:activiti、process、validation、中文文档、jar包、java; 使用方法:解压翻译后的API文档,用浏览器打开“index.html”文件,即可纵览文档...

    org.activiti.designer.updatesite-5.18.1-SNAPSHOT.zip

    eclipse的activit插件org.activiti.designer.updatesite-5.18.1-SNAPSHOT,方便离线安装

    Activiti连接达梦数据库.pdf

    "Activiti连接达梦数据库" Activiti是基于Java的开源工作流引擎,广泛应用于企业级业务流程管理中。然而,在某些国内项目中,需要使用国产的替代方案来替换传统的数据库驱动。达梦数据库是一种国产的数据库管理系统...

    activiti-engine-5.16.4-sources.jar

    activiti-engine-5.16.4-sources.jar-小彭源码免费下载

    activiti-engine-5.21.0-API文档-中英对照版.zip

    Maven坐标:org.activiti:activiti-engine:5.21.0; 标签:activiti、engine、中英对照文档、jar包、java; 使用方法:解压翻译后的API文档,用浏览器打开“index.html”文件,即可纵览文档内容。 人性化翻译,文档...

    Eclipse Jee Oxygen 安装Activiti-5.1.8.0(绕开在线资源下载)

    &lt;feature id="org.activiti.designer.feature" version="5.18.0.201508100929" url="features/org.activiti.designer.feature_5.18.0.201508100929/"&gt; 2.C:\Users\Administrator\.p2\pool 把activiti的jar分别放...

    Eclipse离线集成activiti所需jar('org.eclipse.emf 2.6.0' but it could not be found解决方案)

    Software being installed: Activiti Eclipse BPMN 2.0 Designer 5.18.0.201508100929 (org.activiti.designer.feature.feature.group 5.14.0.201508100929) Missing requirement: Activiti Eclipse BPMN 2.0 ...

    activiti-process-validation-5.21.0-API文档-中英对照版.zip

    Maven坐标:org.activiti:activiti-process-validation:5.21.0; 标签:activiti、process、validation、中英对照文档、jar包、java; 使用方法:解压翻译后的API文档,用浏览器打开“index.html”文件,即可纵览...

    部署Activiti-activiti-5.22.0源代码工程缺的一些jar包

    antlr-3.3.jar,antlr-runtime-3.3.jar,btm-2.1.3.jar,catch-exception-1.2.0.jar,dcharts-widget-0.10.0.jar,drools-compiler-5.5.0.Final.jar,drools-core-5.5.0.Final.jar,ecj-3.5.1.jar,javax.enterprise....

    activiti-5.22.0.zip

    3. **流程定义与部署**:在源码中,我们可以看到 `org.activiti.engine.ProcessDefinition` 和 `org.activiti.engine.RepositoryService` 相关接口,它们用于定义和部署流程定义文件(通常是 .bpmn20.xml 文件)。...

    Activiti Designer插件jar包

    Missing requirement: Activiti Eclipse BPMN 2.0 Designer 5.14.1 (org.activiti.designer.feature.feature.group 5.14.1) requires 'org.eclipse.emf.validation 1.4.0' but it could not be found 没安装过这...

Global site tag (gtag.js) - Google Analytics