自定义错误页面不适用于 Weld &汤姆猫7
在我的网络应用程序中,我尝试使用自定义错误页面。
然而,这不适用于焊接。当我导航到应用程序中不存在的页面而不是获取自定义错误页面时,我看到 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在焊接上下文中,类路径中仅存在weld-servlet.jar,仅此而已
In context of weld only weld-servlet.jar is present in classpath, nothing more