开发者

Custom error page does not work with Weld & Tomcat7

开发者 https://www.devze.com 2023-03-25 09:25 出处:网络
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

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.Http11Pr开发者_如何学运维otocol$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?


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

0

精彩评论

暂无评论...
验证码 换一张
取 消