Skip to content

MockHttpServletRequest needs servlet api 4.0 after upgrade from 5.3.3 to 5.3.4 #26566

Closed
@jirkait

Description

@jirkait

Affects: Spring Framework 5.3.4

After upgrading spring to 5.3.4 the constructor of MockHttpServletRequest throws java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletMapping. The project uses older servlet api 3.1 because the tomcat 8.5.x is still used in production.

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.1.0</version>
            <scope>provided</scope>
        </dependency>

When the version of servlet api is changed to 4.0.0 or above, the exception is of course gone.

In [1] is mentioned that the older API should be sufficient for spring framework 5.x.

The Java EE 7 API level is required in Spring's corresponding modules now, with runtime support for the EE 8 level

[1] https://github.com/spring-projects/spring-framework/wiki/Upgrading-to-Spring-Framework-5.x

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: testIssues in the test modulestatus: duplicateA duplicate of another issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions