SRVE0260E: The server cannot use the error page specified for your application to handle the Original Exception printed below

veote picture veote · Feb 25, 2014 · Viewed 22.8k times · Source

I'm trying to use some error pages in a JSF application which is deployed on IBM WebSphere Application Server 8.0.0.8. They are declared as follows in web.xml:

<error-page>
    <error-code>403</error-code>
    <location>/error403.jsp</location>
</error-page>
<error-page>
    <exception-type>javax.faces.application.ViewExpiredException</exception-type>
    <location>/expired.xhtml</location>
</error-page>
<error-page>
    <error-code>500</error-code>
    <location>/error500.xhtml</location>
</error-page>

However, they don't seem to work. For instance, when I get a ViewExpiredException after restarting the application, I'm not redirected to the error page, but I get the following SRVE0260E error in the server log:

Error Page Exception
SRVE0260E: The server cannot use the error page specified for your application to handle the Original Exception printed below.

Original Exception:
Error Message: javax.servlet.ServletException: /help.xhtmlNo saved view state could be found for the view identifier: /help.xhtml
Error Code: 500
Target Servlet: Faces Servlet
Error Stack:
javax.faces.application.ViewExpiredException: /help.xhtmlNo saved view state could be found for the view identifier: /help.xhtml
     at org.apache.myfaces.lifecycle.RestoreViewExecutor.execute(RestoreViewExecutor.java:128)
     at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:172)
     at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:119)
     at javax.faces.webapp.FacesServlet.service(FacesServlet.java:189)
     at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1230)
     at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:779)
     at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)
     at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
     at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1071)
     at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3774)
     at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304)
     at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:981)
     at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662)
     at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:200)
     at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:453)
     at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:515)
     at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:306)
     at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:84)
     at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)
     at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
     at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
     at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
     at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
     at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
     at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
     at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1702)



Error Page Exception:
Error Message: javax.servlet.ServletException: WebBeans context with scope type annotation @RequestScoped does not exist within current thread
Error Code: 0
Target Servlet:
Error Stack:
javax.enterprise.context.ContextNotActiveException: WebBeans context with scope type annotation @RequestScoped does not exist within current thread
     at org.apache.webbeans.container.BeanManagerImpl.getContext(BeanManagerImpl.java:321)
     at org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler.getContextualInstance(NormalScopedBeanInterceptorHandler.java:124)
     at org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler.invoke(NormalScopedBeanInterceptorHandler.java:95)
     at org.apache.webbeans.conversation.ConversationImpl_$$_javassist_40.isTransient(ConversationImpl_$$_javassist_40.java)
     at org.apache.webbeans.jsf.WebBeansPhaseListener.beforePhase(WebBeansPhaseListener.java:93)
     at org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersBefore(PhaseListenerManager.java:76)
     at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:160)
     at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:119)
     at javax.faces.webapp.FacesServlet.service(FacesServlet.java:189)
     at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1230)
     at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:779)
     at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)
     at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
     at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1071)
     at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:1385)
     at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:194)
     at com.ibm.ws.webcontainer.webapp.WebApp.sendError(WebApp.java:3276)
     at com.ibm.ws.webcontainer.webapp.WebApp.handleException(WebApp.java:3804)
     at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3785)
     at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304)
     at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:981)
     at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662)
     at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:200)
     at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:453)
     at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:515)
     at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:306)
     at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:84)
     at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)
     at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
     at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
     at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
     at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
     at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
     at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
     at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1702) 

How is this caused and how can I solve it?

Answer

jbergmark picture jbergmark · Mar 3, 2014

It appears that the Error Page handling is going through the JSF processor, but for some reason the requestDestroyed() method has already fired ending the request context. The CDI PhaseListener is then throwing the exception when it can't find the request context.

You should be able to work around this issue by using a non-JSF based error page. Perhaps a static file, or JSP would work.

Otherwise I suggest you open a PMR so that the request issue can be resolved.