The following stacktrace is what I get when i try to access a servlet, which seems running fine from Tomcat manager.
11 Sep, 2012 11:50:12 AM org.apache.catalin
My case was using Java 8 lamda expressions with older version of Rest that was not based on Java 8
I also saw this exception where the @Resource annotation caused a conflict with two technologies stepping on each other's toes (tomcat servlet api 3, and spring).
I got the similar exception
While moving from java 8 to java 11 I got the following error
Exception org.apache.catalina.core.ApplicationContext.log Servlet.init() for servlet [health-servlet] threw exception java.lang.IllegalArgumentException
To fix the error i upgraded the version in pom
<jersey.version>2.23.2</jersey.version><!-- Remove this -->
<jersey.version>2.30.1</jersey.version><!-- Add this -->
I had the following entry in my web.xml
<servlet>
<servlet-name>health-servlet</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>com.xyz.platform.registry.service.ServiceRegistryApplication</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
Go to the Project Properties -> Deployment Assembly -> Check whether the maven dependencies are visible, if they are missing the also we get the same error. I could resolve my adding the maven dependency into the Deployment Assembly.
[After adding Maven dependency into the Deployment Assembly, it seems like this]
https://i.stack.imgur.com/7iwaW.jpg
For me, it happened when I was using Lambda expression inside my junit tests. After commenting from the tests, the server returned the proper api response.
Finally , got my mistake. This was a problem caused by the eclipse build. Since the build was not proper, the class files where corrupted. I cleaned up the whole project, took a fresh build, now its working fine. Thanks for your replies.