anil reddy
anil reddy

Reputation: 39

java.lang.NoSuchMethodError: 'javax.servlet.http.HttpServletMapping javax.servlet.http.HttpServletRequest.getHttpServletMapping()'

I'm getting the NoSuchmethodError while hitting the endpoints from the postman. I have recently migrated from spring 1.15 to 2.5.8.

Here are my spring versions. id 'org.springframework.boot' version '2.5.8' id 'io.spring.dependency-management' version '1.0.11.RELEASE'

Any thoughts on fixing the issue?

Upvotes: 3

Views: 7847

Answers (1)

Harsh
Harsh

Reputation: 972

Possibilities & resolution !

  1. Check if that method is available under the class under which it is throwing error! You can check it from under Maven dependencies by expanding that particular library.

  2. Check if your pom.xml does not contain same dependency declarations (with same or different versions)

  3. Delete the redundant dependency from classpath to make sure only one exist. Most likely, NoSuchMethodError appears when there is more than 1 same dependency on classpath and and older version (or first encountered) is picked up !

Check if these articles help

How do I fix a NoSuchMethodError?

How to resolve java.lang.NoSuchMethodError

How to get java.lang.NoSuchMethodError

Upvotes: 3

Related Questions