Chun ping Wang
Chun ping Wang

Reputation: 3929

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).

Upvotes: 0

Views: 5398

Answers (4)

Alex H
Alex H

Reputation: 431

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.

Upvotes: 0

BalusC
BalusC

Reputation: 1109272

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.

Upvotes: 2

Buhake Sindi
Buhake Sindi

Reputation: 89189

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).

Upvotes: 0

vickirk
vickirk

Reputation: 4067

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.

Upvotes: 1

Related Questions