java.lang.stackoverflowerror on jsf application with tomcat
Hi i am trying to figure out stackoverflow error.
All i know is the error come开发者_C百科s from
org.apache.catalina.core.ApplicationDispatcher.setAttribute on line 278
But I have no idea whats causing it.
What is the best way to trace the error? This is like finding a needle in a hay stack since there are over 50 classes.
How do I know which method is calling this to get an error? (like which method do I want to turn debug mode on to trace this stackoverflow).
It's hard to nail down the real cause without seeing the stacktrace and interpreting/understanding the repeating patterns.
However, the most common beginner's mistakes which can cause a StackOverflowError
in a JSF webapplication are the following:
An invalid
FacesServlet
mapping. E.g. mapped on*.jsp
while views are by itself already*.jsp
. You should map it on something else, e.g.*.jsf
. This is not necessary when you're using JSF2 with Facelets. Both the views and mapping can be*.xhtml
.A JSF view file with an invalid file extension. E.g. actually having a
page.jsf
file instead of apage.jsp
orpage.xhtml
while theFacesServlet
is mapped on*.jsf
.
I dare to bet that yours is caused by either of those causes. Other possible causes usually boils down to own bad code in backing bean classes, but it would usually not have involved container's internal classes such as org.apache.catalina.core.ApplicationDispatcher
in the repeating part of the trace.
best way to trace the error is to look at the stack trace, there is probably something recursive going on, your trace will probably have repeating sequences of method calls.
In TOMCAT_HOME/logs/
folder (Tomcat 6 & 7), there's a catalina.yyyy-mm-dd.log
file that contains all the logged messages (including exceptions thrown by the application). Get the latest (today's) log file and see where the exception was thrown (usually the most recent time the error occurred).
I had this problem and for me it seemed to have been a bug - Creating an empty faces-config.xml made it go away (was the workaround). CDI was also configured/installed.
精彩评论