Error Handling

View: New views
2 Messages — Rating Filter:   Alert me  

Error Handling

by Tim Corless :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I found that I have a NullPointerException in the my prerender code of my ViewController but I don't get an error page.  I have set EXCEPTION_DISPATCH_PATH and it looks like when Shale does the redirect to my error page, the redirect causes an IllegalStateException.  I have MyFaces default error handling on but I don't get an error page at all.  Does anyone know how I get my error page to display?
 
<context-param>
    <param-name>org.apache.shale.view.EXCEPTION_DISPATCH_PATH</param-name>
    <param-value>/actions/app/Error.action</param-value>
</context-param>
 
[2009-05-05 08:39:27,566] [WebContainer : 20] *ERROR* org.apache.myfaces.lifecycle.PhaseListenerManager - Exception in PhaseListener RENDER_RESPONSE(6) afterPhase
java.lang.IllegalStateException: Cannot forward. Response already committed.
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:157)
at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:425)
at org.apache.shale.view.faces.ViewPhaseListener.afterPhaseExceptionCheck(ViewPhaseListener.java:202)
 
Thanks
-Tim

Re: Error Handling

by Cyril Bouteille-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Tim, it's likely because the error happened during the rendering phase
after the beginning of the HTML has already been flushed on the response
socket...
You have a couple of options:
1) move your offending code into prerender event and add an <s:subview>
very high in your page markup so it's executed before a lot of markup is
written on the socket, or
2) increase the page buffer size to be larger than the content before
your exception is triggered, e.g. <%@ page buffer="10kb" %>
Hope it helps,
--
Cyril Bouteille
TravelMuse, Inc.

Tim Corless wrote:

> I found that I have a NullPointerException in the my prerender code of my ViewController but I don't get an error page.  I have set EXCEPTION_DISPATCH_PATH and it looks like when Shale does the redirect to my error page, the redirect causes an IllegalStateException.  I have MyFaces default error handling on but I don't get an error page at all.  Does anyone know how I get my error page to display?
>  
> <context-param>
>     <param-name>org.apache.shale.view.EXCEPTION_DISPATCH_PATH</param-name>
>     <param-value>/actions/app/Error.action</param-value>
> </context-param>
>  
> [2009-05-05 08:39:27,566] [WebContainer : 20] *ERROR* org.apache.myfaces.lifecycle.PhaseListenerManager - Exception in PhaseListener RENDER_RESPONSE(6) afterPhase
> java.lang.IllegalStateException: Cannot forward. Response already committed.
> at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:157)
> at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:425)
> at org.apache.shale.view.faces.ViewPhaseListener.afterPhaseExceptionCheck(ViewPhaseListener.java:202)
>  
> Thanks
> -Tim
>  



smime.p7s (4K) Download Attachment