Camunda:javax.servlet.ServletException:无法读取安全过滤器配置文件“/securityFilterRules.json”:servlet 上下文中没有此类资源

Camunda: javax.servlet.ServletException: Could not read security filter config file '/securityFilterRules.json': no such resource in servlet context

Communda 应用程序 application.properties 是这样的:

logging.level.org.springframework.web=DEBUG
spring.http.log-request-details=true
spring.datasource.url=${DB_URL}
spring.datasource.username=${DB_USERNAME}
spring.datasource.password=${DB_PASSWORD}
spring.jpa.generate-ddl=true
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true
spring.jersey.application-path=engine-rest
prop.rest_login=${CAMUNDA_REST_AUTH_LOGIN:demo1}
prop.rest_password=${CAMUNDA_REST_AUTH_PASSWORD:demo2}
prop.rest_enabled=${RestAuthEnabled:false}
camunda.bpm.admin-user.id=demo5
camunda.bpm.admin-user.password=demo5
sentry.dsn=${DSN_SENTRY_KEY}
sentry.in-app-includes=com.example.demo
#sentry.logging.minimum-event-level=info
#sentry.logging.minimum-breadcrumb-level=debug
server.port=8080
camunda.bpm.webapp.application-path=/
prop.environment=${ENV:DEV}
camunda.bpm.authorization.enabled=true

和那样的 pom.xml (parent):

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

    <version>7.13.0</version>
    <groupId>com.example</groupId>
    <artifactId>parent-project</artifactId>
    <packaging>pom</packaging>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.3.0.RELEASE</version>
        <relativePath/>
    </parent>

    <properties>
        <camunda.version>7.13.0</camunda.version>
    </properties>

    <modules>
        <module>camunda-project</module>
        <module>springboot-customized-webapp-webjar</module>
        <module>cockpit-sample-plugin</module>
        <module>cockpit-incident-plugin</module>
        <module>cockpit-execution-plugin</module>
        <module>cockpit-deleteprocesses-plugin</module>
        <module>cockpit-migration-plugin</module>
        <module>cockpit-processes-plugin</module>
        <module>cockpit-dashboardprocesses-plugin</module>
        <module>cockpit-deletedeployments-plugin</module>
    </modules>

    <!-- https://mvnrepository.com/artifact/javax.ws.rs/javax.ws.rs-api -->
    <dependencies>
        <dependency>
            <groupId>javax.ws.rs</groupId>
            <artifactId>javax.ws.rs-api</artifactId>
            <version>2.1.1</version>
        </dependency>
    </dependencies>

</project>

和 springboot 应用程序本身的模块:

<?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>com.example</groupId>
        <artifactId>parent-project</artifactId>
        <version>7.13.0</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <artifactId>demo</artifactId>
    <version>${commit.name}</version>
    <name>demo</name>
    <packaging>jar</packaging>
    <description>Demo</description>

    <properties>
        <jdk.version>11</jdk.version>
        <mainClass>com.example.demo.DemoApplication</mainClass>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jdbc</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-csv</artifactId>
            <version>1.6</version>
        </dependency>
        <dependency>
            <groupId>org.camunda.bpm.springboot</groupId>
            <artifactId>camunda-bpm-spring-boot-starter-rest</artifactId>
            <version>${camunda.version}</version>
        </dependency>

        <dependency>
            <groupId>org.camunda.bpm.assert</groupId>
            <artifactId>camunda-bpm-assert</artifactId>
            <version>7.0.0</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.camunda.spin</groupId>
            <artifactId>camunda-spin-dataformat-json-jackson</artifactId>
            <version>1.9.0</version>
        </dependency>
        <dependency>
            <groupId>org.camunda.spin</groupId>
            <artifactId>camunda-spin-core</artifactId>
            <version>1.9.0</version>
        </dependency>
        <dependency>
            <groupId>org.camunda.bpm</groupId>
            <artifactId>camunda-engine-plugin-spin</artifactId>
            <version>${camunda.version}</version>
        </dependency>

        <dependency>
            <groupId>com.example</groupId>
            <artifactId>springboot-customized-webapp-webjar</artifactId>
            <version>1.0-SNAPSHOT</version>
        </dependency>

        <dependency>
            <groupId>org.camunda.bpm.springboot</groupId>
            <artifactId>camunda-bpm-spring-boot-starter-webapp</artifactId>
            <version>${camunda.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.camunda.bpm.webapp</groupId>
                    <artifactId>camunda-webapp-webjar</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>com.example</groupId>
            <artifactId>cockpit-sample-plugin</artifactId>
            <version>1.0-SNAPSHOT</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>com.example</groupId>
            <artifactId>cockpit-incident-plugin</artifactId>
            <version>1.0-SNAPSHOT</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>com.example</groupId>
            <artifactId>cockpit-execution-plugin</artifactId>
            <version>1.0-SNAPSHOT</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>com.example</groupId>
            <artifactId>cockpit-deleteprocesses-plugin</artifactId>
            <version>1.0-SNAPSHOT</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>com.example</groupId>
            <artifactId>cockpit-migration-plugin</artifactId>
            <version>1.0-SNAPSHOT</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>com.example</groupId>
            <artifactId>cockpit-processes-plugin</artifactId>
            <version>1.0-SNAPSHOT</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>com.example</groupId>
            <artifactId>cockpit-dashboardprocesses-plugin</artifactId>
            <version>1.0-SNAPSHOT</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>com.example</groupId>
            <artifactId>cockpit-deletedeployments-plugin</artifactId>
            <version>1.0-SNAPSHOT</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.camunda.bpm.extension/camunda-bpm-process-test-coverage -->
        <dependency>
            <groupId>org.camunda.bpm.extension</groupId>
            <artifactId>camunda-bpm-process-test-coverage</artifactId>
            <version>0.3.2</version>
            <scope>test</scope>
        </dependency>

        <!--security-->

        <dependency>
            <groupId>org.springframework.ldap</groupId>
            <artifactId>spring-ldap-core</artifactId>
        </dependency>

        <dependency>
            <groupId>com.unboundid</groupId>
            <artifactId>unboundid-ldapsdk</artifactId>
        </dependency>

        <dependency>
            <groupId>org.camunda.bpm.identity</groupId>
            <artifactId>camunda-identity-ldap</artifactId>
            <version>7.13.0</version>
        </dependency>

        <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-all</artifactId>
            <version>2.4.20</version>
        </dependency>

        <dependency>
            <groupId>org.camunda.bpm.extension</groupId>
            <artifactId>camunda-bpm-reactor-core</artifactId>
            <version>1.2</version>
        </dependency>

        <dependency>
            <groupId>io.sentry</groupId>
            <artifactId>sentry-spring</artifactId>
            <version>1.7.5</version>
        </dependency>

        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>2.8.6</version>
        </dependency>

    </dependencies>

    <build>
        <plugins>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>${jdk.version}</source>
                    <target>${jdk.version}</target>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>${mainClass}</mainClass>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.5.1</version>
                <executions>
                    <execution>
                        <id>copy-dependencies</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <includeScope>runtime</includeScope>
                            <outputDirectory>${project.build.directory}/dependency-jars/</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.0</version>
            </plugin>

            <plugin>
                <groupId>com.google.cloud.tools</groupId>
                <artifactId>jib-maven-plugin</artifactId>
                <version>2.4.0</version>
                <configuration>
                    <allowInsecureRegistries>true</allowInsecureRegistries>
                    <container>
                        <entrypoint>
                            <arg>/bin/sh</arg>
                            <arg>-c</arg>
                            <arg>java -DDB_URL=$DB_URL -DDB_PASSWORD=$DB_PASSWORD -DDB_USERNAME=$DB_USERNAME -DCAMUNDA_REST_AUTH_LOGIN=$CAMUNDA_REST_AUTH_LOGIN -DCAMUNDA_REST_AUTH_PASSWORD=$CAMUNDA_REST_AUTH_PASSWORD -DRestAuthEnabled=$RestAuthEnabled -DDSN_SENTRY_KEY=$DSN_SENTRY_KEY -DENV=$ENV -Xms$JAVA_XMS -Xmx$JAVA_XMX -cp /app/resources/:/app/classes/:/app/libs/* ${mainClass}</arg>
                        </entrypoint>
                    </container>
                    <from>
                        <image>docker-registry.x5.ru/adoptopenjdk/openjdk11:alpine-jre</image>
                    </from>
                    <to>
                        <auth>
                            <username>${ART_LOGIN}</username>
                            <password>${ART_PASSWORD}</password>
                        </auth>
                    </to>
                </configuration>
            </plugin>

        </plugins>
    </build>

    <distributionManagement>
        <repository>
        it is ok here
        </repository>
    </distributionManagement>

</project>

最后得到bean初始化错误:

   org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'lazyInitRegistration' defined in class path resource [org/camunda/bpm/spring/boot/starter/webapp/CamundaBpmWebappAutoConfiguration.class]: Initialization of bean failed; nested exception is java.lang.RuntimeException: javax.servlet.ServletException: Could not read security filter config file '/securityFilterRules.json': no such resource in servlet context.

特别是对于这个问题,通过使用 -pl-am 选项构建其他模块解决了这个问题:

mvn clean install -pl springboot-customized-webapp-webjar -pl cockpit-sample-plugin -pl cockpit-incident-plugin -pl cockpit-execution-plugin -pl cockpit-deleteprocesses-plugin -pl cockpit-processes-plugin -pl cockpit-dashboardprocesses-plugin -pl cockpit-deletedeployments-plugin -pl cockpit-migration-plugin -am