You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Tomcat10部署Flowable7.0 flowable-rest.war时filter注册失败求助

解决Flowable 7.0 + Spring Boot 3.1.3 在Tomcat 10中部署的过滤器注册错误问题

问题根源分析

Spring Boot 3.1.x 与 Tomcat 10 存在过滤器注册兼容性冲突,ErrorPageFilter 的注册逻辑在 Servlet 5.0(Tomcat 10 基于该规范)下触发致命错误,而 Flowable 7.0 依赖的 Spring Boot 3.1.3 未针对该场景适配。Flowable 6.8 依赖的 Spring Boot 版本更低,且 Tomcat 9 基于 Servlet 4.0,因此仅出现非致命警告。

可行解决方案

1. 手动禁用Spring Boot的ErrorPageFilter

通过配置类或配置文件关闭该过滤器的自动注册:

  • 配置类方式:
import org.springframework.boot.web.servlet.filter.ErrorPageFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class TomcatCompatConfig {
    @Bean
    public FilterRegistrationBean<ErrorPageFilter> disableErrorPageFilter() {
        FilterRegistrationBean<ErrorPageFilter> registration = new FilterRegistrationBean<>(new ErrorPageFilter());
        registration.setEnabled(false);
        return registration;
    }
}
  • 配置文件方式(application.properties):
spring.boot.web.servlet.error.register-error-page-filter=false

2. 降级Spring Boot版本至3.0.x

Spring Boot 3.0.x 不存在该过滤器注册问题,修改Flowable项目的pom.xml,锁定Spring Boot依赖版本:

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-dependencies</artifactId>
            <version>3.0.11</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

降级后需验证核心功能,Flowable 7.0 与 Spring Boot 3.0.x 兼容性良好。

3. 修改Tomcat容器配置规避冲突

在Tomcat的conf/context.xml中添加配置,阻止冲突过滤器的自动注册:

<Context>
    <Valve className="org.apache.catalina.valves.ErrorReportValve" showReport="false" showServerInfo="false"/>
</Context>

此方式无需修改Flowable代码,直接通过容器配置解决问题。

4. 使用Spring Boot内置Tomcat运行

Flowable Rest本身是Spring Boot应用,可直接打包为可执行JAR运行,绕开外部Tomcat的兼容性问题:

  • 打包命令:
mvn clean package -DskipTests
  • 启动命令:
java -jar flowable-rest-7.0.0.jar

验证步骤

  1. 应用任一方案后重新部署flowable-rest.war到Tomcat 10
  2. 启动Tomcat,确认日志中不再出现Failed to register 'filter errorPageFilterRegistration'错误
  3. 访问Flowable Rest接口(如http://localhost:8080/flowable-rest/management/engine)验证服务正常响应

内容的提问来源于stack exchange,提问作者Abe

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.08 12:55:11