java.lang.IllegalStateException: PWC1227: Cannot forward after response has been

Splash Forums PrettyFaces Users java.lang.IllegalStateException: PWC1227: Cannot forward after response has been

This topic contains 12 replies, has 2 voices, and was last updated by  luyzdeleon 8 years, 4 months ago.

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
  • #24986


    I just followed the tutorial to include this in my webapp and i get this everytime there’s a redirect:

    WARNING: StandardWrapperValve[default]: PWC1406: Servlet.service() for servlet default threw exception
    java.lang.IllegalStateException: PWC1227: Cannot forward after response has been committed
    	at org.apache.catalina.core.ApplicationDispatcher.doDispatch(
    	at org.apache.catalina.core.ApplicationDispatcher.dispatch(
    	at org.apache.catalina.core.ApplicationDispatcher.forward(
    	at org.ocpsoft.rewrite.servlet.impl.HttpRewriteResultHandler.handleResult(
    	at org.ocpsoft.rewrite.servlet.RewriteFilter.rewrite(
    	at org.ocpsoft.rewrite.servlet.RewriteFilter.doFilter(
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(
    	at org.apache.catalina.core.StandardWrapperValve.invoke(
    	at org.apache.catalina.core.StandardContextValve.invoke(
    	at org.apache.catalina.core.StandardPipeline.doInvoke(
    	at org.apache.catalina.core.StandardPipeline.invoke(
    	at org.apache.catalina.core.StandardHostValve.invoke(
    	at org.apache.catalina.connector.CoyoteAdapter.doService(
    	at org.apache.catalina.connector.CoyoteAdapter.service(
    	at com.sun.grizzly.http.ProcessorTask.invokeAdapter(
    	at com.sun.grizzly.http.ProcessorTask.doProcess(
    	at com.sun.grizzly.http.ProcessorTask.process(
    	at com.sun.grizzly.http.DefaultProtocolFilter.execute(
    	at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(
    	at com.sun.grizzly.DefaultProtocolChain.execute(
    	at com.sun.grizzly.DefaultProtocolChain.execute(
    	at com.sun.grizzly.http.HttpProtocolChain.execute(
    	at com.sun.grizzly.ProtocolChainContextTask.doCall(
    	at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(
    	at com.sun.grizzly.util.AbstractThreadPool$

    Things i tried:
    1.- Different bean scopes.
    2.- Adding this to my bean post-construct: FacesContext.getCurrentInstance().getExternalContext().getSession(true);
    3.- Too much googling.

    I am using Glassfish and Mojarra 2.1.24

    Thanks for your time.


    Could you show us your configuration. Especially the ConfigurationProvider you are using?



    I am using a pretty-config.xml, i attached it.

    • This reply was modified 8 years, 4 months ago by  luyzdeleon.


    Also if i may add, for some reason after a few seconds the page reloads when i have the pretty-faces configuration.


    Hmmm. That’s weird. Your configuration looks good. I’ve never seen something like this before. Does this happen for all pages?

    Could you perhaps create a minimal sample application to reproduce this issue? This would allow me to do some debugging to find the root cause.



    Would you be up to create a skype/hangouts session? i am working on this right now and i have some urgency.


    The page reloads automatically? Could you use the development tools of your browser to check why the reload is triggered.



    I am sorry the automatic reloads are not pretty faces fault, it’s something else, but the exception above is.


    Sorry, I’m busy myself right now…

    The exception is basically telling you, that PrettyFaces tries to forward the request from the virtual pretty one (for example “/login”) to the real one (for example “/login.xhtml”). This fails because the response has already been committed, which means that someone already wrote something to the response.

    How did you map the FacesServlet? The view-id has to be the same URL you typically enter into the browser bar. Something like /faces/login.xhtml or /login.jsf.



    This is my web.xml, you can see the faces servlet mapping.


    I’m just guessing here, but you could try to remove the error handling part for the ViewExpiredException from the web.xml and check if this helps.

    If this doesn’t help, you will have to debug the cause. At some point during request processing HttpServletReponse.isCommitted() switches from false to true. This is the cause for the exception.

    You could also try to remove all mappings from your pretty-config.xml to see if the exception still occurs.



    I tried removing all mappings from the pretty-config.xml and saw that when i access my url through the file name everything looks good, it only happens when i use a pretty config mapping. Ill check the other solutions.



    I will just have to stop using the library in the meantime, thank you for your help.

Viewing 13 posts - 1 through 13 (of 13 total)

The forum ‘PrettyFaces Users’ is closed to new topics and replies.

Comments are closed.