最近用activiti做一个很简单的小例子,自我感觉哪里都没问题,但是就是报:
org.activiti.engine.ActivitiObjectNotFoundException: no processes deployed with key 'myprocess'
的错误,最后查资料终于找到了原因,那就是 activiti 的模版必须以 bpmn20.xml 或者 bpmn结尾;
代码如下:
目录结构:
AvtivitiAction
public class AvtivitiAction { @Test public void startProcess(){ ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine(); RepositoryService repositoryService = processEngine.getRepositoryService(); DeploymentBuilder builder = repositoryService.createDeployment(); builder.addClasspathResource("leave.bpmn20.xml"); builder.deploy(); // select * from `ACT_GE_PROPERTY`;这时这个表中会多条数据 Listp = repositoryService.createProcessDefinitionQuery().list(); for(int i=0;i
activiti.cfg.xml
leave.bpmn20.xml