我尝试在我的 spring boot - 基于 Gradle 的项目中实现 Camunda http-connector,使用以下 Gradle 配置和依赖项,项目正确构建,但当我运行该项目时,它返回:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'processEngineFactoryBean': FactoryBean threw exception on object creation; nested exception is org.camunda.bpm.engine.ParseException: ENGINE-09005 Could not parse BPMN process. Errors:
* One of the attributes 'class', 'delegateExpression', 'type', or 'expression' is mandatory on serviceTask. If you are using a connector, make sure theconnect process engine plugin is registered with the process engine. | resource some-path\test.bpmn | line 27 | column 46
我使用了 Camunda 文档中的步骤。这是我的
build.gradle
文件。
buildscript {
dependencies {
classpath 'org.yaml:snakeyaml:1.26'
}
}
plugins {
id 'org.springframework.boot' version '2.5.8'
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
id 'java'
id "org.liquibase.gradle" version "2.0.2"
id 'jacoco'
}
group = 'some-group'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 11
targetCompatibility = 11
repositories {
//mavenCentral()
maven {
url "some-url"
}
}
ext {
sentryVersion = '5.3.0'
}
test {
finalizedBy jacocoTestReport
}
jacocoTestReport {
reports {
xml.enabled true
html.enabled true
csv.enabled false
}
}
dependencies {
// ==== Spring dependencies ====
implementation "org.springframework.boot:spring-boot-starter-web"
implementation "org.springframework.boot:spring-boot-starter-data-jpa"
// Sentry
implementation "io.sentry:sentry-logback:$sentryVersion"
// implementation 'org.camunda.bpm.springboot:camunda-bpm-spring-boot-starter-rest:7.17.0'
implementation 'org.camunda.bpm.springboot:camunda-bpm-spring-boot-starter-webapp:7.15.0'
implementation 'org.camunda.bpm.extension:camunda-bpm-identity-keycloak:7.15.0'
// implementation 'org.camunda.bpm.springboot:camunda-bpm-spring-boot-starter:7.15.0'
// https://mvnrepository.com/artifact/org.camunda.bpm.springboot/camunda-bpm-spring-boot-starter-rest
implementation 'org.camunda.bpm.springboot:camunda-bpm-spring-boot-starter-rest:7.19.0'
// https://mvnrepository.com/artifact/org.camunda.bpm/camunda-engine-plugin-connect
// implementation 'org.camunda.bpm:camunda-engine-plugin-connect:7.20.0-alpha2'
// implementation 'com.nimbusds:oauth2-oidc-sdk:9.12'
implementation 'org.springframework.boot:spring-boot-starter-security'
// implementation 'org.camunda.bpm.extension:camunda-platform-7-keycloak:7.17.0'
implementation 'org.keycloak:keycloak-spring-boot-starter:15.0.2'
// implementation 'org.springframework.security:spring-security-oauth2-core:5.5.1'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client:2.6.2'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server'
implementation 'org.slf4j:slf4j-api:1.7.32'
implementation 'ch.qos.logback:logback-classic:1.2.5'
implementation 'org.keycloak:keycloak-core:21.1.1'
implementation 'org.camunda.bpm.extension:camunda-bpm-identity-keycloak:2.2.3'
// Camunda Connector
implementation 'org.camunda.connect:camunda-connect-http-client:1.3.0'
implementation 'org.camunda.connect:camunda-connect-soap-http-client:1.3.0'
implementation 'org.camunda.connect:camunda-connect-core:1.1.0'
implementation 'org.camunda.bpm:camunda-engine:7.15.0'
implementation 'org.camunda.spin:camunda-spin-core:1.9.0'
implementation 'org.camunda.spin:camunda-spin-dataformat-json-jackson:1.9.0'
implementation 'org.camunda.spin:camunda-spin-dataformat-xml-dom:1.9.0'
implementation 'org.camunda.bpm:camunda-engine-plugin-spin:7.15.0'
implementation 'org.camunda.bpm:camunda-bom:7.15.0'
implementation 'org.camunda.bpm.dmn:camunda-engine-dmn-bom:7.15.0'
implementation 'org.camunda.connect:camunda-connect-connectors-all:1.0.0'
implementation 'org.camunda.bpm:camunda-engine-plugin-connect:7.15.0'
// Postgres JDBC
runtimeOnly 'org.postgresql:postgresql'
runtimeOnly 'com.h2database:h2'
runtimeOnly 'com.sun.xml.bind:jaxb-impl:2.2.3'
// Lombok
implementation "org.projectlombok:lombok"
annotationProcessor "org.projectlombok:lombok"
implementation "org.keycloak:keycloak-admin-client:13.0.0"
}
def appProperties = new org.yaml.snakeyaml.Yaml().load(file("src/main/resources/application-local.yml").newInputStream())
def liquibaseProperties = new org.yaml.snakeyaml.Yaml().load(file("src/main/resources/liquibase.yaml").newInputStream())
diffChangeLog.dependsOn assemble
//liquibase {
// activities {
// main {
// changeLogFile "src/main/resources/db/changelog/changes/V" + migrationNumber() + "_changelog.yaml"
// referenceUrl 'hibernate:spring:' + liquibaseProperties.getAt("entities-package-path") + '?dialect=' + liquibaseProperties.dialect
// url appProperties.spring.datasource.url
// username appProperties.spring.datasource.username
// password appProperties.spring.datasource.password
// driver liquibaseProperties.driver
// }
// }
//}
static def migrationNumber() {
def files = new File("src/main/resources/db/changelog/changes")
.listFiles();
if (files == null)
return 0
return files.size();
}
jar {
enabled = true
}
这是我的 Camunda BPMN 流程文件:
<?xml version="1.0" encoding="UTF-8"?>
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="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" id="_1bTwQUkWEeO-QfaFiKQ6Gw" targetNamespace="http://camunda.org/examples" exporter="Camunda Modeler" exporterVersion="5.15.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
<bpmn2:message id="Message_3a4udev" name="Message_3a4udev" />
<bpmn2:process id="CAMT_Management_Workflow_V1.0" name="CAMT_Management_Workflow_V1.0" isExecutable="true">
<bpmn2:scriptTask id="scriptTask" name="Welcome Message" scriptFormat="groovy">
<bpmn2:extensionElements>
<camunda:inputOutput>
<camunda:inputParameter name="player">
<camunda:script scriptFormat="groovy">
players = ["Fritz", "Heinz", "Horst", "Klaus"]
players[new Random().nextInt(players.size())]
</camunda:script>
</camunda:inputParameter>
</camunda:inputOutput>
</bpmn2:extensionElements>
<bpmn2:script>
println "Hello $player! Welcome to our casino"
</bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:endEvent id="Event_0ze79i7">
<bpmn2:incoming>Flow_16h5tsc</bpmn2:incoming>
</bpmn2:endEvent>
<bpmn2:startEvent id="Event_0dillfr">
<bpmn2:outgoing>Flow_0vfmd2r</bpmn2:outgoing>
</bpmn2:startEvent>
<bpmn2:sequenceFlow id="Flow_0vfmd2r" sourceRef="Event_0dillfr" targetRef="Activity_0vcor0x" />
<bpmn2:serviceTask id="Activity_0vcor0x">
<bpmn2:extensionElements>
<camunda:connector>
<camunda:inputOutput>
<camunda:inputParameter name="method">POST</camunda:inputParameter>
<camunda:inputParameter name="payload">{
"assessmentRequestId": "CA-2309-03858",
"emailType": "EMAIL_FOR_ASSESSMENT_UPDATE"
}</camunda:inputParameter>
<camunda:inputParameter name="url">http://localhost:8180/email/send-email</camunda:inputParameter>
</camunda:inputOutput>
<camunda:connectorId>http-connector</camunda:connectorId>
</camunda:connector>
</bpmn2:extensionElements>
<bpmn2:incoming>Flow_0vfmd2r</bpmn2:incoming>
<bpmn2:outgoing>Flow_16h5tsc</bpmn2:outgoing>
</bpmn2:serviceTask>
<bpmn2:sequenceFlow id="Flow_16h5tsc" sourceRef="Activity_0vcor0x" targetRef="Event_0ze79i7" />
</bpmn2:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CAMT_Management_Workflow_V1.0">
<bpmndi:BPMNShape id="Event_0dillfr_di" bpmnElement="Event_0dillfr">
<dc:Bounds x="152" y="82" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_0ok0d83_di" bpmnElement="Activity_0vcor0x">
<dc:Bounds x="340" y="70" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_0ze79i7_di" bpmnElement="Event_0ze79i7">
<dc:Bounds x="602" y="102" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="Flow_0vfmd2r_di" bpmnElement="Flow_0vfmd2r">
<di:waypoint x="188" y="100" />
<di:waypoint x="259" y="100" />
<di:waypoint x="259" y="110" />
<di:waypoint x="340" y="110" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_16h5tsc_di" bpmnElement="Flow_16h5tsc">
<di:waypoint x="440" y="110" />
<di:waypoint x="526" y="110" />
<di:waypoint x="526" y="120" />
<di:waypoint x="602" y="120" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn2:definitions>
我也有同样的问题。有人可以帮忙吗?