I am facing an issue during deployment of a service in Tomcat 8. Getting following error :
Caused by: java.lang.NoSuchMethodError: javax.servlet.Ser
Spring boot will run tomcat 7 per default, you have to override maven build tomcat.version in your pom.xml. See below to run tomcat 8.0.30
<properties>
<tomcat.version>8.0.30</tomcat.version>
</properties>
Should fix your problem.
If you have used this dependency:
<dependency>
<groupId>com.google.oauth-client</groupId>
<artifactId>google-oauth-client-jetty</artifactId>
<version>1.23.0</version>
</dependency>
Then please exclude as below:
<dependency>
<groupId>com.google.oauth-client</groupId>
<artifactId>google-oauth-client-jetty</artifactId>
<version>1.23.0</version>
<exclusions>
<exclusion>
<artifactId>servlet-api</artifactId>
<groupId>org.mortbay.jetty</groupId>
</exclusion>
</exclusions>
</dependency>
After a huge pain & sifting through all these stackoverflow answers the only thing that ended up working for me was downgrading from tomcat8 to tomcat7. I know this isn't an ideal solution, and perhaps it was just a fresh install of tomcat that solved my problem. If all else fails give that a shot.
This surely has something to do with the version of javax.servlet and version of Tomcat.
In my case, it went away when I declared javax.servlet dependency in gradle with no version. Like this -
compile('javax.servlet:servlet-api')
Check all your Maven (or equivalent) dependencies and make sure that you - or most likely another dependency - are not pulling in a pre-3.1 version of the javax.servlet / servlet-api
that may be taking precedence over what's in your Tomcat 8. If you've manually deployed, make sure you haven't manually copied any servlet-api JARs into Tomcat itself.
See: https://stackoverflow.com/a/26232535/954442
Solved On my mac with java 8 was facing issue with downloaded tomcat from site and unzip.
My issue got solved because there was a extra servlet-api.jar file which was getting picked up. It was coming from /Library/Java/Extensions/servlet-api.jar
For finding it in your system you can use sudo find / -name servlet-api.jar
Removed it by backing it up somewhere else.
I was following this for intallation https://gist.github.com/ddanailov-nmdp/c97aba2ca926b9627f6b4f7174083a32