zoukankan      html  css  js  c++  java
  • 启动Activiti项目报错:org.activiti.engine.ActivitiObjectNotFoundException: no deployed process definition found with id '22501'

    背景

    • 启动activiti项目时,出现错误org.activiti.engine.ActivitiObjectNotFoundException: no deployed process definition found with id '22501'

    原因

    • 获取流程实例信息时,创建查询语句不正确
    • 下面是出错的代码
            //获取进程方法
            RepositoryService repositoryService = processEngine.getRepositoryService();
            RuntimeService runtimeService = processEngine.getRuntimeService1
            //部署流程
            DeploymentBuilder createDeployment = repositoryService.createDeployment();
            DeploymentBuilder addClasspathResource = createDeployment.addClasspathResource("diagrams/Vacation.bpmn");
            Deployment deploy = addClasspathResource.deploy();
            //获取流程实例信息
            DeploymentQuery createDeploymentQuery = repositoryService.createDeploymentQuery();
            DeploymentQuery deploymentId = createDeploymentQuery.deploymentId(deploy.getId());
            
            Deployment singleResult = deploymentId.singleResult();
            //流程开始
            Map<String, Object> vars = new HashMap<String, Object>();
            vars.put("employeeName", "jingguoliang");
            vars.put("numberOfDays", new Integer(4));
            vars.put("VocationMotivation", "I will play with my friendgird");
            ProcessInstance startProcessInstanceById = runtimeService.startProcessInstanceById(singleResult.getId(), vars);            
    • 下面是正确的代码
          //获取进程方法
            RepositoryService repositoryService = processEngine.getRepositoryService();
            RuntimeService runtimeService = processEngine.getRuntimeService();
            
            //定义流程
            DeploymentBuilder createDeployment = repositoryService.createDeployment();
            DeploymentBuilder addClasspathResource = createDeployment.addClasspathResource("diagrams/Vacation.bpmn");
            Deployment deploy = addClasspathResource.deploy();
            
            //获取流程实例信息
            ProcessDefinitionQuery createProcessDefinitionQuery = repositoryService.createProcessDefinitionQuery();
            ProcessDefinitionQuery deploymentId = createProcessDefinitionQuery.deploymentId(deploy.getId());
            
            ProcessDefinition singleResult = deploymentId.singleResult();
            
            //流程开始
            Map<String, Object> vars = new HashMap<String, Object>();
            vars.put("employeeName", "jingguoliang");
            vars.put("numberOfDays", new Integer(4));
            vars.put("VocationMotivation", "I will play with my friendgird");
            ProcessInstance startProcessInstanceById = runtimeService.startProcessInstanceById(singleResult.getId(), vars);
    • 修改即可
  • 相关阅读:
    开通博客园
    ios关键字
    FirstDay
    An example for pysnmp
    remove debug symbols to a seperate file
    qemu下通过gdb调试内核时 遇到 evaluation of this expression requires the program to have a function "malloc" 错误的解决办法
    关于常识与知识的思考
    基于Qemu在ubuntu上构建linux学习环境
    How to download prebuilt toolchain
    诡异的打印异常BUG
  • 原文地址:https://www.cnblogs.com/zuiyue_jing/p/9197081.html
Copyright © 2011-2022 走看看