报错:NoSuchMethodError: ‘void javax.servlet.http.HttpServletResponse.setContentLengthLong(long)
报错:NoSuchMethodError: ‘void javax.servlet.http.HttpServletResponse.setContentLengthLong(long)

报错:NoSuchMethodError: ‘void javax.servlet.http.HttpServletResponse.setContentLengthLong(long)

spring项目报错:

NoSuchMethodError: ‘void javax.servlet.http.HttpServletResponse.setContentLengthLong(long)

这是因为 spring-webmvc 依赖的版本过高,调成 5.2.10.RELEASE 即可:

<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>javax.servlet-api</artifactId>
    <version>3.1.0</version>
    <scope>provided</scope>
</dependency>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-webmvc</artifactId>
    <version>5.2.10.RELEASE</version>
</dependency>

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注