自定义错误页面不适用于 Weld &汤姆猫7

发布于 2024-11-26 23:12:20 字数 3332 浏览 3 评论 0原文

在我的网络应用程序中,我尝试使用自定义错误页面。
然而,这不适用于焊接。当我导航到应用程序中不存在的页面而不是获取自定义错误页面时,我看到 Weld 的异常:

SEVERE: Servlet.service() for servlet Faces Servlet threw exception
java.lang.IllegalStateException: Must call associate() before calling activate()
    at org.jboss.weld.context.AbstractConversationContext.activate(AbstractConversationContext.java:273)
    at org.jboss.weld.jsf.WeldPhaseListener.activateConversations(WeldPhaseListener.java:110)
    at org.jboss.weld.jsf.WeldPhaseListener.beforePhase(WeldPhaseListener.java:84)
    at com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:224)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:95)
    at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:106)
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:114)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:334)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:473)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:402)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:329)
    at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:466)
    at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:387)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:181)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:394)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:243)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

我认为这是 Tomcat 中的错误:

https://issues.apache.org/bugzilla/show_bug.cgi?id=50789

但已修复v.7.0.9

摘自我的 web.xml

<error-page>
    <exception-type>java.lang.Exception</exception-type>
    <location>/pages/error.xhtml</location>
</error-page>
<error-page>
    <error-code>500</error-code>
    <location>/pages/error.xhtml</location>
</error-page>
<error-page>
    <error-code>404</error-code>
    <location>/pages/pageNotFound.xhtml</location>
</error-page>

我正在使用 Tomcat 7.0.19、JSF 2.0 和 Weld 1.1.2。
有什么想法会发生什么吗?

In my web application I'm trying to use custom error page.
However this does not work with Weld. When I navigate to a non-existing page in my app instead of getting custom error page I see exception from Weld:

SEVERE: Servlet.service() for servlet Faces Servlet threw exception
java.lang.IllegalStateException: Must call associate() before calling activate()
    at org.jboss.weld.context.AbstractConversationContext.activate(AbstractConversationContext.java:273)
    at org.jboss.weld.jsf.WeldPhaseListener.activateConversations(WeldPhaseListener.java:110)
    at org.jboss.weld.jsf.WeldPhaseListener.beforePhase(WeldPhaseListener.java:84)
    at com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:224)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:95)
    at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:106)
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:114)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:334)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:473)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:402)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:329)
    at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:466)
    at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:387)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:181)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:394)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:243)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

I thought that this is bug in Tomcat:

https://issues.apache.org/bugzilla/show_bug.cgi?id=50789

however it has been fixed in v.7.0.9

Excerpt from my web.xml:

<error-page>
    <exception-type>java.lang.Exception</exception-type>
    <location>/pages/error.xhtml</location>
</error-page>
<error-page>
    <error-code>500</error-code>
    <location>/pages/error.xhtml</location>
</error-page>
<error-page>
    <error-code>404</error-code>
    <location>/pages/pageNotFound.xhtml</location>
</error-page>

I'm using Tomcat 7.0.19, JSF 2.0 and Weld 1.1.2.
Any ideas what happens?

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

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

发布评论

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

评论(1

花落人断肠 2024-12-03 23:12:20

在焊接上下文中,类路径中仅存在weld-servlet.jar,仅此而已

In context of weld only weld-servlet.jar is present in classpath, nothing more

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