Камунда: Как устранить ошибку ENGINE-09017 для процесса JavaDelegate в приложении Play Framework? - PullRequest
0 голосов
/ 18 марта 2019

Я пытаюсь встроить процесс камунды в приложение PLay2. но я получаю ДВИГАТЕЛЬ-09017 и ДВИГАТЕЛЬ-09008, когда начинаю занятие.

Мои тестовые шаги: - запустить экземпляр процесса => ОК - завершить задачу «Одобрить кредит» => завершить ОК - автоматический запуск "javaTask" => ошибка с ошибкой ENGINE-09008

play. 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>

1 Ответ

0 голосов
/ 01 апреля 2019

Я решил свою проблему, добавив playloader classloader в экземпляр ProcessEngine:

 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);
...