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

Apache's JIRA Issue Tracker | Jeremy Green | 1 decade ago
  1. 0

    [MYFACES-612] IllegalStateException: Cannot forward after response has been committed - ASF JIRA

    apache.org | 11 months ago
    java.lang.IllegalStateException: Cannot forward after response has been committed
  2. 0

    Rapid, multiple clicks on the h:commandButton in the test case given below produce an IllegalStateException and a blank response about 10% of the time. The JSF state-saving method can be client or server. A blank page is sometimes returned even if the clicks are not rapid. The Sun JSF RI 1.1_01 shows the same problem: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6326655 The stack trace is: SEVERE: Servlet.service() for servlet Faces Servlet threw exception java.lang.IllegalStateException: Cannot forward after response has been committed at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:314) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302) at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:415) at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234) at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:300) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:95) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) at java.lang.Thread.run(Thread.java:595) Here is the test case: index.jsp: <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> <html> <head></head> <body> <f:view> <h:form> <p> <h:commandButton value="Submit" /> </p> <p> <h:graphicImage value="image.png" /> </p> </h:form> </f:view> </body> </html> SlowServlet.java, mapped to image.png in web.xml: public class SlowServlet extends HttpServlet { protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { BufferedImage image; OutputStream os; image = new BufferedImage(100, 100, BufferedImage.TYPE_INT_ARGB); os = resp.getOutputStream(); resp.setContentType("image/png"); try { Thread.sleep(1000); } catch (InterruptedException e) { throw new ServletException(e); } try { ImageIO.write(image, "png", os); os.close(); } catch (IOException e) { } } }

    Apache's JIRA Issue Tracker | 1 decade ago | Jeremy Green
    java.lang.IllegalStateException: Cannot forward after response has been committed
  3. 0

    Rapid, multiple clicks on the h:commandButton in the test case given below produce an IllegalStateException and a blank response about 10% of the time. The JSF state-saving method can be client or server. A blank page is sometimes returned even if the clicks are not rapid. The Sun JSF RI 1.1_01 shows the same problem: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6326655 The stack trace is: SEVERE: Servlet.service() for servlet Faces Servlet threw exception java.lang.IllegalStateException: Cannot forward after response has been committed at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:314) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302) at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:415) at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234) at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:300) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:95) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) at java.lang.Thread.run(Thread.java:595) Here is the test case: index.jsp: <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> <html> <head></head> <body> <f:view> <h:form> <p> <h:commandButton value="Submit" /> </p> <p> <h:graphicImage value="image.png" /> </p> </h:form> </f:view> </body> </html> SlowServlet.java, mapped to image.png in web.xml: public class SlowServlet extends HttpServlet { protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { BufferedImage image; OutputStream os; image = new BufferedImage(100, 100, BufferedImage.TYPE_INT_ARGB); os = resp.getOutputStream(); resp.setContentType("image/png"); try { Thread.sleep(1000); } catch (InterruptedException e) { throw new ServletException(e); } try { ImageIO.write(image, "png", os); os.close(); } catch (IOException e) { } } }

    Apache's JIRA Issue Tracker | 1 decade ago | Jeremy Green
    java.lang.IllegalStateException: Cannot forward after response has been committed
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Output Link and Command link problem

    Oracle Community | 9 years ago | 843844
    java.lang.IllegalStateException: Cannot forward after response has been committe d
  6. 0

    [javast] Download com formato PDF

    Google Groups | 8 years ago | Juxtand
    java.lang.IllegalStateException: Cannot forward after response has been committed

    1 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.IllegalStateException

      Cannot forward after response has been committed

      at org.apache.catalina.core.ApplicationDispatcher.doForward()
    2. Glassfish Core
      ApplicationDispatcher.forward
      1. org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:314)
      2. org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
      2 frames
    3. Impl
      LifecycleImpl.render
      1. org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:415)
      2. org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
      3. org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:300)
      3 frames
    4. JavaEE 7
      FacesServlet.service
      1. javax.faces.webapp.FacesServlet.service(FacesServlet.java:95)
      1 frame
    5. Glassfish Core
      ApplicationFilterChain.doFilter
      1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      2 frames
    6. org.netbeans.modules
      MonitorFilter.doFilter
      1. org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)
      1 frame
    7. Glassfish Core
      CoyoteAdapter.service
      1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      3. org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
      4. org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
      5. org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
      6. org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      7. org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
      8. org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      8 frames
    8. Grizzly HTTP
      LeaderFollowerWorkerThread.runIt
      1. org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
      2. org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738)
      3. org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
      4. org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
      4 frames
    9. Tomcat Util
      ThreadPool$ControlRunnable.run
      1. org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
      1 frame
    10. Java RT
      Thread.run
      1. java.lang.Thread.run(Thread.java:595)
      1 frame