使用 tomcat 的 jsf 应用程序出现 java.lang.stackoverflowerror

发布于 2024-11-30 10:19:41 字数 294 浏览 5 评论 0原文

您好,我正在尝试找出 stackoverflow 错误。

我所知道的是错误来自

org.apache.catalina.core.ApplicationDispatcher.setAttribute 上线 278

但我不知道是什么原因造成的。

追踪错误的最佳方法是什么?这就像大海捞针一样,因为有 50 多个类。

我如何知道哪个方法调用此方法会出现错误? (就像我想打开调试模式来跟踪这个 stackoverflow 的方法一样)。

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

不喜欢何必死缠烂打 2024-12-07 10:19:41

如果不查看堆栈跟踪并解释/理解重复模式,就很难确定真正的原因。

然而,初学者最常见的可能导致 JSF Web 应用程序中出现 StackOverflowError 的错误如下:

  • 无效的 FacesServlet 映射。例如映射到*.jsp,而视图本身已经是*.jsp。您应该将其映射到其他内容,例如*.jsf。当您将 JSF2 与 Facelets 结合使用时,这不是必需的。视图和映射都可以是 *.xhtml

  • 具有无效文件扩展名的 JSF 视图文件。例如,实际上有一个 page.jsf 文件,而不是 page.jsppage.xhtml,而 >FacesServlet 映射到 *.jsf

我敢打赌,你的问题是由其中任何一个原因引起的。其他可能的原因通常归结为支持 bean 类中的错误代码,但通常不会涉及跟踪的重复部分中的容器内部类,例如 org.apache.catalina.core.ApplicationDispatcher 。 。

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.

眼泪淡了忧伤 2024-12-07 10:19:41

跟踪错误的最佳方法是查看堆栈跟踪,可能正在发生一些递归操作,您的跟踪可能会有重复的方法调用序列。

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.

过期情话 2024-12-07 10:19:41

在 TOMCAT_HOME/logs/ 文件夹(Tomcat 6 和 7)中,有一个 catalina.yyyy-mm-dd.log 文件,其中包含所有记录的消息(包括抛出的异常)由应用程序)。获取最新(今天)的日志文件并查看抛出异常的位置(通常是最近发生错误的时间)。

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

我早已燃尽 2024-12-07 10:19:41

我遇到了这个问题,对我来说这似乎是一个错误 - 创建一个空的 faces-config.xml 使其消失(是解决方法)。 CDI 也已配置/安装。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文