问题
I'm getting the following error in my IDE when trying to deploy my application. The error goes on for 50 pages so I only attached the most significant part below and a little more at the bottom of this post. The error makes sense but the class throwing it doesn't exist.
Error Message
Apr 25, 2013 12:10:45 AM org.apache.catalina.core.ApplicationDispatcher invoke SEVERE: Servlet.service() for servlet HomeController threw exception java.lang.StackOverflowError
Problem:
What is strange is that I have deleted the servlet HomeController, removed it from Web.xml, performed a search for all instances of it, and performed a clean and build several times. I still get this error message about an exception being thrown by a non-existent class? I'm guessing some project related file is still referencing this file but it's still very weird.
System Properties
Apache Tomcat 7.014
Netbeans 7.0.1
More of the Error message
Apr 25, 2013 12:10:45 AM org.apache.catalina.core.ApplicationContext log INFO:
The server side component of the HTTP Monitor has detected a java.lang.StackOverflowError. This happens when there is an infinite loop in the web module. Correct the cause of the infinite loop before running the web module again.
Apr 25, 2013 12:10:45 AM org.apache.catalina.core.ApplicationDispatcher invoke SEVERE: Servlet.service() for servlet HomeController threw exception java.lang.StackOverflowError at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:895) at javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:229) at org.apache.catalina.core.ApplicationHttpRequest.getSession(ApplicationHttpRequest.java:572) at javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:229) at org.apache.catalina.core.ApplicationHttpRequest.getSession(ApplicationHttpRequest.java:572) at javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:229) at org.apache.catalina.core.ApplicationHttpRequest.getSession(ApplicationHttpRequest.java:572) at javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:229) at org.apache.catalina.core.ApplicationHttpRequest.getSession(ApplicationHttpRequest.java:572) at javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:229) at org.apache.catalina.core.ApplicationHttpRequest.getSession(ApplicationHttpRequest.java:572) at javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:229) at org.apache.catalina.core.ApplicationHttpRequest.getSession(ApplicationHttpRequest.java:572) at javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:229) at org.apache.catalina.core.ApplicationHttpRequest.getSession(ApplicationHttpRequest.java:572)
回答1:
This is one of those "non-linear" errors that doesn't seem to be the direct result of anything I did. I deployed to a new version of Tomcat and the problem is gone. I must assume then that Tomcat has it's own "repository" of classes to execute and that structure is corrupted. Either way I have found a solution. I just hope it doesn't happen on the new version of Tomcat I'm running...
来源:https://stackoverflow.com/questions/16221269/java-lang-stackoverflowerror-being-thrown-by-class-that-doesnt-exist