当前位置: 动力学知识库 > 问答 > 编程问答 >

java.lang.stackoverflowerror on jsf application with tomcat

问题描述:

Hi i am trying to figure out stackoverflow error.

All i know is the error comes 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 a page.jsp or page.xhtml while the FacesServlet 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.

分享给朋友:
您可能感兴趣的文章:
随机阅读: