初学activiti,在参考编写流程定义文件后,部署到activiti后,根据流程名称查询流程信息,始终报错:
org.activiti.engine.ActivitiObjectNotFoundException: no processes deployed with key 'helloword' at org.activiti.engine.impl.persistence.deploy.DeploymentManager.findDeployedLatestProcessDefinitionByKey(DeploymentManager.java:125) at org.activiti.engine.impl.cmd.StartProcessInstanceCmd.execute(StartProcessInstanceCmd.java:79) at org.activiti.engine.impl.cmd.StartProcessInstanceCmd.execute(StartProcessInstanceCmd.java:37) 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:37) 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.startProcessInstanceByKey(RuntimeServiceImpl.java:69) at com.feng.test02.Test02Main.start(Test02Main.java:58) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
代码如下:
单元测试类:
@Before
public void before(){
//创建流程引擎
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("classpath:com/feng/test02/activiti-config.xml");
ProcessEngineConfiguration config = ctx.getBean( ProcessEngineConfiguration.class);
config.setProcessEngineName("测试流程引擎");
engine = config.buildProcessEngine();
}
@Test
public void build() throws Exception{
//部署流程定义文件
RepositoryService repositoryService = engine.getRepositoryService();
Deployment deployment = repositoryService.createDeployment().addClasspathResource("com/feng/test02/helloword.bpmn.xml").name("helloword").deploy();
//验证已部署流程定义
System.out.println("流程部署ID:"+ deployment.getId());
System.out.println("流程部署Name:"+deployment.getName());
}
/**
* 启动流程实例
*/
@Test
public void start(){
// 启动并获取流程实例
ProcessInstance processInstance= engine.getRuntimeService() // 运行时流程实例Service
.startProcessInstanceByKey("helloword"); // 流程定义表的KEY字段值
System.out.println("流程实例ID:"+processInstance.getId());
System.out.println("流程定义ID:"+processInstance.getProcessDefinitionId());
}
流程定义xml如下:
<?xml version="1.0" encoding="UTF-8"?> <definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test"> <process id="helloword" name="helloword process" isExecutable="true"> <startEvent id="startevent1" name="Start"></startEvent> <endEvent id="endevent1" name="End"></endEvent> <userTask id="usertask1" name="HelloWorld" activiti:assignee="feng"></userTask> <sequenceFlow id="flow1" sourceRef="startevent1" targetRef="usertask1"></sequenceFlow> <sequenceFlow id="flow2" sourceRef="usertask1" targetRef="endevent1"></sequenceFlow> </process> <bpmndi:BPMNDiagram id="BPMNDiagram_myFirstProcess"> <bpmndi:BPMNPlane bpmnElement="myFirstProcess" id="BPMNPlane_myFirstProcess"> <bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1"> <omgdc:Bounds height="35.0" width="35.0" x="200.0" y="40.0"></omgdc:Bounds> </bpmndi:BPMNShape> <bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1"> <omgdc:Bounds height="35.0" width="35.0" x="200.0" y="200.0"></omgdc:Bounds> </bpmndi:BPMNShape> <bpmndi:BPMNShape bpmnElement="usertask1" id="BPMNShape_usertask1"> <omgdc:Bounds height="55.0" width="105.0" x="165.0" y="110.0"></omgdc:Bounds> </bpmndi:BPMNShape> <bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1"> <omgdi:waypoint x="217.0" y="75.0"></omgdi:waypoint> <omgdi:waypoint x="217.0" y="110.0"></omgdi:waypoint> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2"> <omgdi:waypoint x="217.0" y="165.0"></omgdi:waypoint> <omgdi:waypoint x="217.0" y="200.0"></omgdi:waypoint> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </definitions>
将流程定义文件名称的bmpn改为 bmpn20即可。
相关推荐
processEngine.getRepositoryService()//与流程定义和部署相关的service .createDeployment()//创建⼀个部署对象 .name("流程定义⼊门")//添加部署名称 .addClasspathResource("diagrams/helloworld.bpmn")//从...
14.2:部署流程定义+启动流程实例+查询流程实例+查询历史流程实例 47 14.3:总结 47 15:接收活动(receiveTask,即等待活动) 47 15.1:流程图 48 15.2:部署流程定义+启动流程实例 48 16:用户任务(userTask,即...
1.部署流程定义 ,执行此操作后 activiti 会将上边代码中指定的 bpm 文件和图片文件保存在 activiti 数据库。 2.启动一个流程实例 3.任务查询 4.完成任务
流程定义添加(部署) 1.Classpath加载方式; 2.Zip加载方式; 2.流程定义查询 1.查询流程定义; 2.查询某个流程定义的流程设计图片; 3.查询最新版本的流程定义集合; 3.流程定义删除 1.删除key相同的所有...
4.1.2 ProcessDefinitions:流程定义,部署成功后自动创建 4.1.3 ProcessInstances:流程实例,启动流程时创建 4.1.
2. RepositoryService:Activiti中每一个不同版本的业务流程的定义都需要使用一些定义文件,部署文件和支持数据(例如BPMN2.0 XML文件,表单定义文件,流程定义图像文件等),这些文件都存储在Activiti内建的...
1.首先是需要部署流程定义。 2.启动流程实例。 3.查看流程任务以及完成流程任务。 创建一个单元测试类ActivitiHelloWorldTest,首先第一操作流程就必须要获取引擎实例: [java] view plain copy 1. 2. * 获取默认...
可以支持网页版查看,activiti5操作手册,工作流开发学习List of Tables 2.1. 示例用户 2.2. webapp工具 3.1. 支持的数据库 6.1. 6.2. 6.3. 8.1. 邮件服务器配置 8.2. 邮件服务器配置 8.3. Mule服务器...
这个前缀的表包含了流程定义和流程静态资源 (图片,规则,等等)。 ACT_RU_*: 'RU'表示runtime。 这些运行时的表,包含流程实例,任务,变量,异步任务,等运行中的数据。 Activiti只在流程实例执行过程中保存这些...
Activiti 源码分析,流程文件部署主要涉及到 3 个表,分别是:ACT_GE_BYTEARRAY、ACT_RE_DEPLOYMENT、 ...主要完成“部署包”-->“流程定义文件”-->“所有包内文件”的解析部署关系 流程定义的部署需要完成如下操作:
08 API(3)流程定义 09 API(4)任务操作 10 API(5)任务参数与附件 11 API(6)启动流程 12 API(7)流程操作与数据查询 13 API(8)工作的产生与管理 14 BPMN事件(1)事件的分类与定义 15 BPMN事件(2)开始事件 16 ...
springboot 整合activiti 二级审批demo,包含两个bpmn文件,从创建流程引擎、部署流程定义文件、启动运行流程、处理流程任务
文件,表单定义文件,流程定义图像文件等 ),这些文件都存储在 Activiti 内建的 Repository 中。Repository Service 提供了对 repository 的存取服务。 RuntimeService: 在 Activiti 中,每当一个流程定义被启动一次...
能学到什么:①学习Activity7本身的流程定义、部署、任务、执行等底层工作原理及设计思路及使用;②结合实际业务流程与Activity7整合,完成流程全自动化。 阅读建议:此资源以开发简单的人力资源系统,学习Activity...
SpringBoot集成Activiti完整工作流管理系统源码及SQL 包含如下主要内容: 1、工作流完整案例(请假流程、请假会签流程Demo) ...3、支持在线流程模型定义、部署、导出。也可用.bpmn文件直接导入系统
1.4 部署流程定义文档 2.申请模板管理 2.1 添加模板 2.2 修改模板 2.3 删除模板 2.4 下载模板 3.起草申请 3.1 申请列表 3.2 上传申请单 4.待我审批 4.1 带我审批 列表 4.2 审批处理,填写审批意见。是否同意 4.3 ...
ctiviti支持部署*.bpmn20.xml、bar、zip格式的流程定义。 使用Activit Deisigner工具设计流程图的时候会有三个类型的文件: .activiti设计工具使用的文件 .bpmn20.xml设计工具自动根据.activiti文件生成的xml文件 ...
从基础讲起,结合应用场景,由浅到深细化...5.1.1 部署流程定义 5.1.2 启动流程实例 5.1.3 查询待办任务 5.1.4 提交任务 5.1.5 查询候选任务 5.1.6 获取候选任务 5.1.7 通过流程实例ID查询任务流转图 5.2 实战案例二
部署流程定义的时候也可以是ZIP文件 流程运行:涉及到两个对象,四张数据库表: 流程实例 获取流程实例和任务的历史信息 判断流程实例是否为空来判断流程是否结束了 查看...
问题一箩筐-jdbc.properties属性文件设置错误,无法连接数据库, Q) {; h4 t( ?: r& ^ │ 5.问题一箩筐-关于url扩展名称问题 │ 6.问题一箩筐-关于打印日志log4j问题5 y: }- e: Z$ p6 X9 d0 A9 @ │ 7.问题一箩筐-生产...