在win下开发,有时编译或运行项目会报3字节的UTF-8序列的字节3无效。
解决该问题的办法
1、将xml头文件改为GBK编码方式 ,我这里不OK

  • <?xml version="1.0" encoding="GBK"?>  

  • 2、使用Maven修改默认格式 ,我这里不OK

        <build>
            <plugins>
                <!-- resource插件 -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>2.6</version>
                    <configuration>
                        <encoding>UTF-8</encoding>
                    </configuration>
                </plugin>
            </plugins>
        </build>

     

    3、以上如果还不可行,那么在pom.xml里加入 ,我这里不OK

  • <properties>  
  •     <!-- 设置默认编码 -->  
  •     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>  
  • </properties> 
  • 4、修改bpmn文件的编码格式为UTF-8,我这里OK

    用记事本打开bpmn文件,另存为utf-8编码的文件,XML也是utf-8编码格式

    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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
    
        <groupId>ActDemo</groupId>
        <artifactId>Activiti</artifactId>
        <version>1.0-SNAPSHOT</version>
        <properties>
            <!-- 设置默认编码 -->
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        </properties>
        <dependencies>
            <dependency>
                <groupId>org.activiti</groupId>
                <artifactId>activiti-engine</artifactId>
                <version>6.0.0</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>1.7.21</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-log4j12</artifactId>
                <version>1.7.21</version>
            </dependency>
            <dependency>
                <groupId>com.h2database</groupId>
                <artifactId>h2</artifactId>
                <version>1.4.193</version>
            </dependency>
            <dependency>
                <groupId>mysql</groupId>
                <artifactId>mysql-connector-java</artifactId>
                <version>6.0.5</version>
            </dependency>
        </dependencies>
        <build>
            <plugins>
                <!-- resource插件 -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>2.6</version>
                    <configuration>
                        <encoding>UTF-8</encoding>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </project>

    bpmn文件

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" 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" xmlns:tns="http://www.activiti.org/test" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" expressionLanguage="http://www.w3.org/1999/XPath" id="m1520825820812" name="" targetNamespace="http://www.activiti.org/test" typeLanguage="http://www.w3.org/2001/XMLSchema">
      <process id="process1" isClosed="false" isExecutable="true" processType="None">
        <startEvent id="_2" name="StartEvent"/>
        <endEvent id="_3" name="EndEvent"/>
        <userTask activiti:exclusive="true" id="_4" name="软件开发一"/>
        <userTask activiti:exclusive="true" id="_5" name="软件开发二"/>
        <sequenceFlow id="_6" sourceRef="_2" targetRef="_4"/>
        <sequenceFlow id="_7" sourceRef="_4" targetRef="_5"/>
        <sequenceFlow id="_8" sourceRef="_5" targetRef="_3"/>
      </process>
      <bpmndi:BPMNDiagram documentation="background=#FFFFFF;count=1;horizontalcount=1;orientation=0;width=842.4;height=1195.2;imageableWidth=832.4;imageableHeight=1185.2;imageableX=5.0;imageableY=5.0" id="Diagram-_1" name="New Diagram">
        <bpmndi:BPMNPlane bpmnElement="process1">
          <bpmndi:BPMNShape bpmnElement="_2" id="Shape-_2">
            <omgdc:Bounds height="32.0" width="32.0" x="60.0" y="160.0"/>
            <bpmndi:BPMNLabel>
              <omgdc:Bounds height="32.0" width="32.0" x="0.0" y="0.0"/>
            </bpmndi:BPMNLabel>
          </bpmndi:BPMNShape>
          <bpmndi:BPMNShape bpmnElement="_3" id="Shape-_3">
            <omgdc:Bounds height="32.0" width="32.0" x="805.0" y="180.0"/>
            <bpmndi:BPMNLabel>
              <omgdc:Bounds height="32.0" width="32.0" x="0.0" y="0.0"/>
            </bpmndi:BPMNLabel>
          </bpmndi:BPMNShape>
          <bpmndi:BPMNShape bpmnElement="_4" id="Shape-_4">
            <omgdc:Bounds height="55.0" width="85.0" x="275.0" y="190.0"/>
            <bpmndi:BPMNLabel>
              <omgdc:Bounds height="55.0" width="85.0" x="0.0" y="0.0"/>
            </bpmndi:BPMNLabel>
          </bpmndi:BPMNShape>
          <bpmndi:BPMNShape bpmnElement="_5" id="Shape-_5">
            <omgdc:Bounds height="55.0" width="85.0" x="590.0" y="200.0"/>
            <bpmndi:BPMNLabel>
              <omgdc:Bounds height="55.0" width="85.0" x="0.0" y="0.0"/>
            </bpmndi:BPMNLabel>
          </bpmndi:BPMNShape>
          <bpmndi:BPMNEdge bpmnElement="_6" id="BPMNEdge__6" sourceElement="_2" targetElement="_4">
            <omgdi:waypoint x="92.0" y="176.0"/>
            <omgdi:waypoint x="275.0" y="217.5"/>
            <bpmndi:BPMNLabel>
              <omgdc:Bounds height="0.0" width="0.0" x="0.0" y="0.0"/>
            </bpmndi:BPMNLabel>
          </bpmndi:BPMNEdge>
          <bpmndi:BPMNEdge bpmnElement="_7" id="BPMNEdge__7" sourceElement="_4" targetElement="_5">
            <omgdi:waypoint x="360.0" y="217.5"/>
            <omgdi:waypoint x="590.0" y="227.5"/>
            <bpmndi:BPMNLabel>
              <omgdc:Bounds height="0.0" width="0.0" x="0.0" y="0.0"/>
            </bpmndi:BPMNLabel>
          </bpmndi:BPMNEdge>
          <bpmndi:BPMNEdge bpmnElement="_8" id="BPMNEdge__8" sourceElement="_5" targetElement="_3">
            <omgdi:waypoint x="675.0" y="227.5"/>
            <omgdi:waypoint x="805.0" y="196.0"/>
            <bpmndi:BPMNLabel>
              <omgdc:Bounds height="0.0" width="0.0" x="0.0" y="0.0"/>
            </bpmndi:BPMNLabel>
          </bpmndi:BPMNEdge>
        </bpmndi:BPMNPlane>
      </bpmndi:BPMNDiagram>
    </definitions>

    注意格式:为uft-8

    Activiti:MalformedByteSequenceException: 3 字节的 UTF-8 序列的字节 3 无效。

     

    相关文章:

    • 2021-10-18
    • 2022-12-23
    • 2022-12-23
    • 2022-12-23
    • 2022-12-23
    • 2022-02-23
    • 2022-12-23
    • 2022-12-23
    猜你喜欢
    • 2021-10-19
    • 2022-02-11
    • 2021-08-22
    • 2021-07-24
    • 2021-09-23
    • 2022-12-23
    • 2021-11-29
    相关资源
    相似解决方案