【解决】SpringBoot 2+ Activiti 7出现:The deployment contains process definitions with the same key

目前,网络上大部分的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
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值