Camunda:如何解决Play Framework应用程序中JavaDelegate进程的ENGINE-09017错误?

问题描述 投票:0回答:1

我尝试在PLay2应用程序中嵌入一个camunda进程。但是当我开始活动时,我得到了ENGINE-09017和ENGINE-09008。

我的测试步骤: - 启动流程实例=>确定 - 完成“批准贷款”任务=>完成确定 - 自动启动“javaTask”=>失败,错误ENGINE-09008

play.api.http.HttpErrorHandlerExceptions $$ anon $ 1:执行异常[[ProcessEngineException:ENGINE-09008实例化类'controllers.ProcessRequestDelegate'时出现异常:ENGINE-09017无法加载类'controllers.ProcessRequestDelegate':controllers.Pr ocessRequestDelegate]]

你能帮我找到问题所在吗?

问候

听听我的示例java委托:

package controllers;

import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
import play.Logger;

public class ProcessRequestDelegate implements JavaDelegate {
  public ProcessRequestDelegate(){

  }
  @Override
  public void execute(DelegateExecution execution) throws Exception {
      Integer amount = (Integer)execution.getVariable("amount");
      Logger.info("Processing loan approval for amount "+amount+"...");
  }
}

我的启动引擎的模块和处理程序:

public class StartUpHandler{

  private final ProcessEngineConfiguration conf;
  private final ProcessEngine engine;
  private final DeploymentBuilder deployment;

  public StartUpHandler() {


    conf = ProcessEngineConfiguration.createStandaloneProcessEngineConfiguration()
            .setJdbcDriver("org.h2.Driver")
            .setJdbcUrl("jdbc:h2:file:D:/testLoan")
            .setJdbcUsername("camunda")
            .setJdbcPassword("camunda")
            .setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE)
            .setHistory(ProcessEngineConfiguration.HISTORY_FULL)
            .setJobExecutorActivate(true);


    Logger.info("Starting process engine...");
    engine = conf.buildProcessEngine();

    Logger.info("Deploying process definition...");
    deployment = engine.getRepositoryService().createDeployment();
    deployment.addClasspathResource("loan-approval.bpmn").enableDuplicateFiltering(true);

    deployment.deploy();
  }

}

-------------------------------------------------------

import com.google.inject.AbstractModule;
import controllers.StartUpHandler;

import java.time.Clock;


public class StartUpModule extends AbstractModule{

       @Override
    protected void configure() {
        bind(StartUpHandler.class).asEagerSingleton();
    }
}

My Process

和我的BPMN文件:

<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn" xmlns:tns="http://bpmn.io/schema/bpmn" xmlns:xsd="http://www.w3.org/2001/XMLSchema" id="Definitions_1" name="" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.2.4">
  <bpmn:process id="approve-loan" name="Loan Approval Updated" processType="None" isClosed="false" isExecutable="true">
    <bpmn:extensionElements>
      <camunda:properties>
        <camunda:property name="loanAmount" />
      </camunda:properties>
    </bpmn:extensionElements>
    <bpmn:startEvent id="StartEvent_1" name="Loan Request Received" />
    <bpmn:sequenceFlow id="SequenceFlow_0c4zr6d" sourceRef="StartEvent_1" targetRef="UserTask_11fud4o" />
    <bpmn:userTask id="UserTask_11fud4o" name="Approve Loan" activiti:exclusive="true">
      <bpmn:dataOutputAssociation id="DataOutputAssociation_105oy6a">
        <bpmn:targetRef>loanApprovalDS</bpmn:targetRef>
      </bpmn:dataOutputAssociation>
    </bpmn:userTask>
    <bpmn:endEvent id="EndEvent_1i5bz86" name="Loan Request Approved">
      <bpmn:incoming>SequenceFlow_1vf0nn5</bpmn:incoming>
    </bpmn:endEvent>
    <bpmn:sequenceFlow id="SequenceFlow_1y4c0rn" sourceRef="UserTask_11fud4o" targetRef="javaTask" />
    <bpmn:dataStoreReference id="loanApprovalDS" name="Loan Approval DS" />
    <bpmn:sequenceFlow id="SequenceFlow_1vf0nn5" sourceRef="javaTask" targetRef="EndEvent_1i5bz86" />
    <bpmn:serviceTask id="javaTask" name="javaTask" camunda:class="controllers.ProcessRequestDelegate">
      <bpmn:incoming>SequenceFlow_1y4c0rn</bpmn:incoming>
      <bpmn:outgoing>SequenceFlow_1vf0nn5</bpmn:outgoing>
    </bpmn:serviceTask>
  </bpmn:process>
  <bpmndi:BPMNDiagram id="Diagram-_1" name="New Diagram" documentation="background=#3C3F41;count=1;horizontalcount=1;orientation=0;width=842.4;height=1195.2;imageableWidth=832.4;imageableHeight=1185.2;imageableX=5.0;imageableY=5.0">
    <bpmndi:BPMNPlane bpmnElement="approve-loan">
      <bpmndi:BPMNShape id="Shape-StartEvent_1" bpmnElement="StartEvent_1">
        <dc:Bounds x="95" y="140" width="32" height="32" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="0" y="93" width="70" height="27" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Shape-UserTask_11fud4o" bpmnElement="UserTask_11fud4o">
        <dc:Bounds x="146" y="63" width="100" height="80" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="0" y="0" width="100" height="80" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Shape-EndEvent_1i5bz86" bpmnElement="EndEvent_1i5bz86">
        <dc:Bounds x="543" y="79" width="32" height="32" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="178" y="-23" width="70" height="27" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1y4c0rn" bpmnElement="SequenceFlow_1y4c0rn" sourceElement="Shape-UserTask_11fud4o" targetElement="ServiceTask_0ieswob_di">
        <di:waypoint x="246" y="86" />
        <di:waypoint x="356" y="95" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="369" y="110" width="90" height="20" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_0c4zr6d" bpmnElement="SequenceFlow_0c4zr6d" sourceElement="StartEvent_1" targetElement="UserTask_11fud4o">
        <di:waypoint x="111" y="140" />
        <di:waypoint x="111" y="43" />
        <di:waypoint x="196" y="43" />
        <di:waypoint x="196" y="63" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="198.5" y="110" width="90" height="20" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="DataStoreReference_15u5ist_di" bpmnElement="loanApprovalDS">
        <dc:Bounds x="339" y="255" width="50" height="50" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="320" y="308" width="90" height="13" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="DataOutputAssociation_105oy6a_di" bpmnElement="DataOutputAssociation_105oy6a">
        <di:waypoint x="232" y="143" />
        <di:waypoint x="339" y="263" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="SequenceFlow_1vf0nn5_di" bpmnElement="SequenceFlow_1vf0nn5">
        <di:waypoint x="456" y="99" />
        <di:waypoint x="545" y="103" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="ServiceTask_0ieswob_di" bpmnElement="javaTask">
        <dc:Bounds x="356" y="55" width="100" height="80" />
      </bpmndi:BPMNShape>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</bpmn:definitions>
playframework camunda playframework-2.6
1个回答
0
投票

我通过向ProcessEngine instanciation添加play classloader解决了我的问题:

 conf = ProcessEngineConfiguration.createStandaloneProcessEngineConfiguration()
        .setJdbcDriver("org.h2.Driver")
        .setJdbcUrl("jdbc:h2:file:D:/testLoan")
        .setJdbcUsername("camunda")
        .setJdbcPassword("camunda")

        .setClassLoader(StartUpHandler.class.getClassLoader())

        .setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE)
        .setHistory(ProcessEngineConfiguration.HISTORY_FULL)
        .setJobExecutorActivate(true);
© www.soinside.com 2019 - 2024. All rights reserved.