I upgraded from springboot 2.1.3 to 2.2.0. So far things works fine but I noticed when I make a rest request that returns a 400, instead of getting the json response I get the error:
[Tomcat].[localhost] : Exception Processing ErrorPage[errorCode=0, location=/error]
java.lang.NoSuchMethodError: javax.servlet.http.HttpServletRequest.getHttpServletMapping()Ljavax/servlet/http/HttpServletMapping;
The funny thing is I get this only when I start the app from Intellij using an emdedded tomcat. (create a mvn profile with "spring-boot:run")
So,
But I can do the same thing from command line with
mvn spring-boot:run
which then I have no error ?! As suggested on another post I upgraded my IntelliJ to latest version but didn't help
I fixed the problem.
Changing property tomcat.version didn't help, so I omitted it and added this to the child pom (trick is it does not work in parent pom). Also note that the version is 2.2.4 and not 2.2.0
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<version>2.2.4.RELEASE</version>
</dependency>
i think you have to upgrade the version of ur tomcat emdedded , there is a version mismatch. Spring Boot 2.1.X uses Tomcat 9 which has the Servlet API v4. But Spring Boot Web 2.1.X still incorporates Servlet API v3.1. OR Change tomcat version proprety
<properties>
<tomcat.version>8.5.37</tomcat.version>
<properties>
NB:The tomcat.version property is a normal Maven property in your pom.xml. Just add the tomcat.version to your existing Maven properties
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With