目前,网络上大部分的Activiti版本基本都是ACtiviti6.0 ,学习与SpringBoot 2.1.1 整合Activiti 7.0.0.Beta5整合的时候,很多东西需要一步步去探索。作为一个新手,需要不断的积累。
本文为SpringBoot 2.0 和Activiti 7 整合的第一个错误,比较简单,记录如下:
SpringBoot 2.1.1 整合Activiti 7.0.0.Beta5整合完毕,进行单元测试时出现如下错误:
Error while closing command context
org.activiti.engine.ActivitiException: The deployment contains process definitions with the same key (process id attribute), this is not allowed
测试代码如下(参考博客:10分钟轻松搞定SpringBoot集成Activiti6教程)
@RunWith(SpringRunner.class)
@SpringBootTest
public class Springboot0ApplicationTests {
private static final Logger logger = LoggerFactory.getLogger(Springboot0ApplicationTests.class);
@Autowired
private RuntimeService runtimeService;
@Autowired
private TaskService taskService;
@Autowired
private RepositoryService repositoryService;
@Test
public void contextLoads() {
logger.info("测试程序启动:");
logger.info("调用流程存储服务,查询部署数量:{}",repositoryService.createDeploymentQuery().count());
Map<String,Object> map=new HashMap<>();
map.put("apply","lzd");
map.put("approve","lisi");
//流程启动
ExecutionEntity executionEntity = (ExecutionEntity) runtimeService.startProcessInstanceByKey("leave", map);
List<Task> taskList=taskService.createTaskQuery().taskAssignee("lzd").list();
logger.info("任务列表个数:{}",taskList.size());
String assigne="lzd";
List<Task> tasks=taskService.createTaskQuery().taskAssignee(assigne).list();
if (tasks !=null&&tasks.size()>0){
for (Task task:tasks){
logger.info("任务id:{} \n 任务的办理人:{} \n 任务的名称:{}",
task.getId(),task.getAssignee(),task.getName());
}
}
logger.info("流程结束");
}
}
具体报错信息摘录如下:其实开头那几行提示是比较有价值的,其他可以略过。
- **Error while closing command context
org.activiti.engine.ActivitiException: The deployment contains process definitions with the same key (process id attribute), this is not allowed
at org.activiti.engine.impl.bpmn.deployer.BpmnDeploymentHelper.verifyProcessDefinitionsDoNotShareKeys(BpmnDeploymentHelper.java:55)
at org.activiti.engine.impl.bpmn.deployer.BpmnDeployer.deploy(BpmnDeployer.java:68)
at** org.activiti.engine.impl.persistence.deploy.DeploymentManager.deploy(DeploymentManager.java:58)
at org.activiti.engine.impl.cmd.DeployCmd.executeDeploy(DeployCmd.java:97)
at org.activiti.engine.impl.cmd.DeployCmd.execute(DeployCmd.java:47)
at org.activiti.engine.impl.cmd.DeployCmd.execute(DeployCm