运行 sprint-boot activiti 应用程序时出现问题 - “process”不能有角色 [childresn]
- pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.10</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
<activiti.version>5.22.0</activiti.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-spring-boot-starter-basic</artifactId>
<version>${activiti.version}</version>
</dependency>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-spring-boot-starter-jpa</artifactId>
<version>${activiti.version}</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
- 应用程序:
package com.example.demo;
import org.activiti.engine.RuntimeService;
import org.activiti.spring.boot.SecurityAutoConfiguration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@SpringBootApplication(exclude = {SecurityAutoConfiguration.class})
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
@RestController
public static class MyRestComtroller{
@Autowired
private RuntimeService runtimeService;
@RequestMapping(value = "/start-my-process",method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public void startMyProcess(){
runtimeService.startProcessInstanceByKey("test");
System.out.println("we have now" + runtimeService.createNativeProcessInstanceQuery().count() + "process instances");
}
}
}
- 错误:
org.activiti.bpmn.exceptions.XMLException:cvc-complex-type.2.3:元素“process”不能有字符[children],因为该类型的内容类型是仅元素的。
除了此错误我还收到一些警告 - 警告:过程中发生了非法反射访问操作
- :过程中的定义有错误 - 必须声明元素定义。 (此 bpmn20.xml 文件由 alfresco 创建)
<?xml version='1.0' encoding='UTF-8'?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:activiti="http://activiti.org/bpmn"
xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI"
typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath"
targetNamespace="http://www.activiti.org/processdef" xmlns:modeler="http://activiti.com/modeler"
modeler:version="1.0en" modeler:exportDateTime="20220303040839752" modeler:modelId="1"
modeler:modelVersion="1" modeler:modelLastUpdated="1646273308964"
xsi:schemaLocation="http://activiti.com/modeler ">
<process id="test" name="test" isExecutable="true">
<startEvent id="startEvent1">
<extensionElements>
<modeler:editor-resource-id><![CDATA[startEvent1]]></modeler:editor-resource-id>
</extensionElements>
</startEvent>
<userTask id="sid-C4EB4721-09B1-455C-9E6A-FB310EAA193E" name="a" activiti:assignee="$INITIATOR">
<extensionElements>
<modeler:allow-send-email><![CDATA[true]]></modeler:allow-send-email>
<modeler:activiti-idm-initiator><![CDATA[true]]></modeler:activiti-idm-initiator>
<modeler:editor-resource-id><![CDATA[sid-C4EB4721-09B1-455C-9E6A-FB310EAA193E]]></modeler:editor-resource-id>
</extensionElements>
</userTask>
test.bpmn20.xml
<sequenceFlow id="sid-ACECCB48-5BFE-4C0F-A323-CB46E9A69256" sourceRef="startEvent1"
targetRef="sid-C4EB4721-09B1-455C-9E6A-FB310EAA193E">
<extensionElements>
<modeler:editor-resource-id><![CDATA[sid-ACECCB48-5BFE-4C0F-A323-CB46E9A69256]]></modeler:editor-resource-id>
</extensionElements>
</sequenceFlow>
<userTask id="sid-9F06F0E6-7474-4E56-88E9-F0E284A50A44" name="b" activiti:assignee="$INITIATOR">
<extensionElements>
<modeler:allow-send-email><![CDATA[true]]></modeler:allow-send-email>
<modeler:activiti-idm-initiator><![CDATA[true]]></modeler:activiti-idm-initiator>
<modeler:editor-resource-id><![CDATA[sid-9F06F0E6-7474-4E56-88E9-F0E284A50A44]]></modeler:editor-resource-id>
</extensionElements>
</userTask>
<sequenceFlow id="sid-22578A3C-8439-4E94-9A10-1CD6B52789BB" sourceRef="sid-C4EB4721-09B1-455C-9E6A-FB310EAA193E"
targetRef="sid-9F06F0E6-7474-4E56-88E9-F0E284A50A44">
<extensionElements>
<modeler:editor-resource-id><![CDATA[sid-22578A3C-8439-4E94-9A10-1CD6B52789BB]]></modeler:editor-resource-id>
</extensionElements>
</sequenceFlow>
<endEvent id="sid-5A3C22BE-C0B3-4016-A595-529C94B7C84D">
<extensionElements>
<modeler:editor-resource-id><![CDATA[sid-5A3C22BE-C0B3-4016-A595-529C94B7C84D]]></modeler:editor-resource-id>
</extensionElements>
</endEvent>
<sequenceFlow id="sid-CAF1B715-1BF8-4B48-A5A6-62CC0E4870FE" sourceRef="sid-9F06F0E6-7474-4E56-88E9-F0E284A50A44"
targetRef="sid-5A3C22BE-C0B3-4016-A595-529C94B7C84D">
<extensionElements>
<modeler:editor-resource-id><![CDATA[sid-CAF1B715-1BF8-4B48-A5A6-62CC0E4870FE]]></modeler:editor-resource-id>
</extensionElements>
</sequenceFlow>
</process>
<bpmndi:BPMNDiagram id="BPMNDiagram_test">
<bpmndi:BPMNPlane bpmnElement="test" id="BPMNPlane_test">
<bpmndi:BPMNShape bpmnElement="startEvent1" id="BPMNShape_startEvent1">
<omgdc:Bounds height="30.0" width="30.0" x="60.0" y="75.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-C4EB4721-09B1-455C-9E6A-FB310EAA193E"
id="BPMNShape_sid-C4EB4721-09B1-455C-9E6A-FB310EAA193E">
<omgdc:Bounds height="80.0" width="100.0" x="135.0" y="50.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-9F06F0E6-7474-4E56-88E9-F0E284A50A44"
id="BPMNShape_sid-9F06F0E6-7474-4E56-88E9-F0E284A50A44">
<omgdc:Bounds height="80.0" width="100.0" x="280.0" y="50.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-5A3C22BE-C0B3-4016-A595-529C94B7C84D"
id="BPMNShape_sid-5A3C22BE-C0B3-4016-A595-529C94B7C84D">
<omgdc:Bounds height="28.0" width="28.0" x="425.0" y="76.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="sid-ACECCB48-5BFE-4C0F-A323-CB46E9A69256"
id="BPMNEdge_sid-ACECCB48-5BFE-4C0F-A323-CB46E9A69256">
<omgdi:waypoint x="90.0" y="90.0"/>
<omgdi:waypoint x="135.0" y="90.0"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-22578A3C-8439-4E94-9A10-1CD6B52789BB"
id="BPMNEdge_sid-22578A3C-8439-4E94-9A10-1CD6B52789BB">
<omgdi:waypoint x="235.0" y="90.0"/>
<omgdi:waypoint x="280.0" y="90.0"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-CAF1B715-1BF8-4B48-A5A6-62CC0E4870FE"
id="BPMNEdge_sid-CAF1B715-1BF8-4B48-A5A6-62CC0E4870FE">
<omgdi:waypoint x="380.0" y="90.0"/>
<omgdi:waypoint x="425.0" y="90.0"/>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>
- 过程:过程中的定义有错误 - 必须声明元素定义。 (这个 bpmn20.xml 文件由 alfresco 创建)
- The pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.10</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
<activiti.version>5.22.0</activiti.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-spring-boot-starter-basic</artifactId>
<version>${activiti.version}</version>
</dependency>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-spring-boot-starter-jpa</artifactId>
<version>${activiti.version}</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
- the app:
package com.example.demo;
import org.activiti.engine.RuntimeService;
import org.activiti.spring.boot.SecurityAutoConfiguration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@SpringBootApplication(exclude = {SecurityAutoConfiguration.class})
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
@RestController
public static class MyRestComtroller{
@Autowired
private RuntimeService runtimeService;
@RequestMapping(value = "/start-my-process",method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public void startMyProcess(){
runtimeService.startProcessInstanceByKey("test");
System.out.println("we have now" + runtimeService.createNativeProcessInstanceQuery().count() + "process instances");
}
}
}
- the error :
org.activiti.bpmn.exceptions.XMLException: cvc-complex-type.2.3: Element 'process' cannot have character [children], because the type's content type is element-only.
except of this error I'm also get a few warning -
WARNING: An illegal reflective access operation has occurred
- the procces : in the procces have error on the definition - Element definitions must be declared. (this bpmn20.xml file create by alfresco)
<?xml version='1.0' encoding='UTF-8'?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:activiti="http://activiti.org/bpmn"
xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI"
typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath"
targetNamespace="http://www.activiti.org/processdef" xmlns:modeler="http://activiti.com/modeler"
modeler:version="1.0en" modeler:exportDateTime="20220303040839752" modeler:modelId="1"
modeler:modelVersion="1" modeler:modelLastUpdated="1646273308964"
xsi:schemaLocation="http://activiti.com/modeler ">
<process id="test" name="test" isExecutable="true">
<startEvent id="startEvent1">
<extensionElements>
<modeler:editor-resource-id><![CDATA[startEvent1]]></modeler:editor-resource-id>
</extensionElements>
</startEvent>
<userTask id="sid-C4EB4721-09B1-455C-9E6A-FB310EAA193E" name="a" activiti:assignee="$INITIATOR">
<extensionElements>
<modeler:allow-send-email><![CDATA[true]]></modeler:allow-send-email>
<modeler:activiti-idm-initiator><![CDATA[true]]></modeler:activiti-idm-initiator>
<modeler:editor-resource-id><![CDATA[sid-C4EB4721-09B1-455C-9E6A-FB310EAA193E]]></modeler:editor-resource-id>
</extensionElements>
</userTask>
test.bpmn20.xml
<sequenceFlow id="sid-ACECCB48-5BFE-4C0F-A323-CB46E9A69256" sourceRef="startEvent1"
targetRef="sid-C4EB4721-09B1-455C-9E6A-FB310EAA193E">
<extensionElements>
<modeler:editor-resource-id><![CDATA[sid-ACECCB48-5BFE-4C0F-A323-CB46E9A69256]]></modeler:editor-resource-id>
</extensionElements>
</sequenceFlow>
<userTask id="sid-9F06F0E6-7474-4E56-88E9-F0E284A50A44" name="b" activiti:assignee="$INITIATOR">
<extensionElements>
<modeler:allow-send-email><![CDATA[true]]></modeler:allow-send-email>
<modeler:activiti-idm-initiator><![CDATA[true]]></modeler:activiti-idm-initiator>
<modeler:editor-resource-id><![CDATA[sid-9F06F0E6-7474-4E56-88E9-F0E284A50A44]]></modeler:editor-resource-id>
</extensionElements>
</userTask>
<sequenceFlow id="sid-22578A3C-8439-4E94-9A10-1CD6B52789BB" sourceRef="sid-C4EB4721-09B1-455C-9E6A-FB310EAA193E"
targetRef="sid-9F06F0E6-7474-4E56-88E9-F0E284A50A44">
<extensionElements>
<modeler:editor-resource-id><![CDATA[sid-22578A3C-8439-4E94-9A10-1CD6B52789BB]]></modeler:editor-resource-id>
</extensionElements>
</sequenceFlow>
<endEvent id="sid-5A3C22BE-C0B3-4016-A595-529C94B7C84D">
<extensionElements>
<modeler:editor-resource-id><![CDATA[sid-5A3C22BE-C0B3-4016-A595-529C94B7C84D]]></modeler:editor-resource-id>
</extensionElements>
</endEvent>
<sequenceFlow id="sid-CAF1B715-1BF8-4B48-A5A6-62CC0E4870FE" sourceRef="sid-9F06F0E6-7474-4E56-88E9-F0E284A50A44"
targetRef="sid-5A3C22BE-C0B3-4016-A595-529C94B7C84D">
<extensionElements>
<modeler:editor-resource-id><![CDATA[sid-CAF1B715-1BF8-4B48-A5A6-62CC0E4870FE]]></modeler:editor-resource-id>
</extensionElements>
</sequenceFlow>
</process>
<bpmndi:BPMNDiagram id="BPMNDiagram_test">
<bpmndi:BPMNPlane bpmnElement="test" id="BPMNPlane_test">
<bpmndi:BPMNShape bpmnElement="startEvent1" id="BPMNShape_startEvent1">
<omgdc:Bounds height="30.0" width="30.0" x="60.0" y="75.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-C4EB4721-09B1-455C-9E6A-FB310EAA193E"
id="BPMNShape_sid-C4EB4721-09B1-455C-9E6A-FB310EAA193E">
<omgdc:Bounds height="80.0" width="100.0" x="135.0" y="50.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-9F06F0E6-7474-4E56-88E9-F0E284A50A44"
id="BPMNShape_sid-9F06F0E6-7474-4E56-88E9-F0E284A50A44">
<omgdc:Bounds height="80.0" width="100.0" x="280.0" y="50.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-5A3C22BE-C0B3-4016-A595-529C94B7C84D"
id="BPMNShape_sid-5A3C22BE-C0B3-4016-A595-529C94B7C84D">
<omgdc:Bounds height="28.0" width="28.0" x="425.0" y="76.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="sid-ACECCB48-5BFE-4C0F-A323-CB46E9A69256"
id="BPMNEdge_sid-ACECCB48-5BFE-4C0F-A323-CB46E9A69256">
<omgdi:waypoint x="90.0" y="90.0"/>
<omgdi:waypoint x="135.0" y="90.0"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-22578A3C-8439-4E94-9A10-1CD6B52789BB"
id="BPMNEdge_sid-22578A3C-8439-4E94-9A10-1CD6B52789BB">
<omgdi:waypoint x="235.0" y="90.0"/>
<omgdi:waypoint x="280.0" y="90.0"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-CAF1B715-1BF8-4B48-A5A6-62CC0E4870FE"
id="BPMNEdge_sid-CAF1B715-1BF8-4B48-A5A6-62CC0E4870FE">
<omgdi:waypoint x="380.0" y="90.0"/>
<omgdi:waypoint x="425.0" y="90.0"/>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>
- the procces : in the procces have error on the definition - Element definitions must be declared. (this bpmn20.xml file create by alfresco)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论