• 启动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);
    • 修改即可
  • 相关阅读:
    JAVA程序员必看的面试题
    百度技术研发笔试题目
    IBM-JAVA面试题
    .net 面试题系列文章二(附答案)
    Reactive Extensions简介一
    不用恢复出厂设置删除google账户的方法
    如何通过使用64位版本 Windows 查看系统注册表
    Google Goggles的图像识别很好很强大
    实现类似IE的松散耦合(LooselyCoupled )效果——Window Tabifier
    C#的二维码生成和解析
  • 原文地址:https://www.cnblogs.com/zuiyue_jing/p/9197081.html
Copyright © 2020-2023  润新知