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 2 years, 10 months ago.

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

    luyzdeleon
    Participant

    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(ApplicationDispatcher.java:375)
    	at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:355)
    	at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:305)
    	at org.ocpsoft.rewrite.servlet.impl.HttpRewriteResultHandler.handleResult(HttpRewriteResultHandler.java:38)
    	at org.ocpsoft.rewrite.servlet.RewriteFilter.rewrite(RewriteFilter.java:262)
    	at org.ocpsoft.rewrite.servlet.RewriteFilter.doFilter(RewriteFilter.java:187)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    	at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
    	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
    	at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
    	at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
    	at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
    	at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
    	at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)
    	at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)
    	at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)
    	at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
    	at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
    	at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
    	at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
    	at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
    	at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
    	at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
    	at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
    	at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
    	at java.lang.Thread.run(Thread.java:722)
    

    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 3.1.2.2 and Mojarra 2.1.24

    Thanks for your time.

    #24987

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

    #24988

    luyzdeleon
    Participant

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

    • This reply was modified 2 years, 10 months ago by  luyzdeleon.
    Attachments:
    1. pretty-config2.xml
    #24991

    luyzdeleon
    Participant

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

    #24992

    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.

    #24993

    luyzdeleon
    Participant

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

    #24994

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

    #24995

    luyzdeleon
    Participant

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

    #24996

    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.

    #24997

    luyzdeleon
    Participant

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

    Attachments:
    1. web1.xml
    #24999

    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.

    #25000

    luyzdeleon
    Participant

    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.

    #25001

    luyzdeleon
    Participant

    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)

You must be logged in to reply to this topic.

Comments are closed.