MyFaces Core
  1. MyFaces Core
  2. MYFACES-1346

exception when using a custom error page and a 404 occurs with an address that matches pattern for FasesServlet

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.1.1, 1.1.3
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:
      JBoss-3.2.7

      Description

      I have defined a custom error page and mapped it (among others) to 404 errors in web.xml:
      <error-page>
      <error-code>400</error-code>
      <location>/error.jspx</location>
      </error-page>

      It works for all addresses except those that match the mapping for the FacesServlet (*.jsf).
      When a page that doesn't exist is requested, a standard Tomcat error page is shown instead of the custom error page and the following exception is logged:

      2006-06-29 12:50:32,655 ERROR TP-Processor6 [Engine] ApplicationDispatcher[] Servlet.service() for servlet jsp threw exception
      java.lang.IllegalStateException: getOutputStream() has already been called for this response
      at org.apache.coyote.tomcat5.CoyoteResponse.getWriter(CoyoteResponse.java:600)
      at org.apache.coyote.tomcat5.CoyoteResponseFacade.getWriter(CoyoteResponseFacade.java:164)
      at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:124)
      at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:117)
      at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:191)
      at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:115)
      at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:75)
      at org.apache.jsp.error_jspx._jspService(error_jspx.java:185)
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:696)
      at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:476)
      at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:409)
      at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:312)
      at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:396)
      at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:301)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:147)
      at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
      at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:535)
      at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
      at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
      at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:300)
      at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:374)
      at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:743)
      at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:675)
      at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:866)
      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
      at java.lang.Thread.run(Thread.java:534)
      2006-06-29 12:50:32,657 ERROR TP-Processor6 [Engine] org.apache.catalina.core.StandardHostValve@77c8d6: Exception Processing ErrorPage[errorCode=404, location=/error.jspx]
      java.lang.IllegalStateException: getOutputStream() has already been called for this response
      at org.apache.coyote.tomcat5.CoyoteResponse.getWriter(CoyoteResponse.java:600)
      at org.apache.coyote.tomcat5.CoyoteResponseFacade.getWriter(CoyoteResponseFacade.java:164)
      at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:124)
      at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:117)
      at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:191)
      at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:115)
      at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:75)
      at org.apache.jsp.error_jspx._jspService(error_jspx.java:185)
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:696)
      at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:476)
      at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:409)
      at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:312)
      at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:396)
      at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:301)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:147)
      at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
      at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:535)
      at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
      at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
      at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:300)
      at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:374)
      at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:743)
      at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:675)
      at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:866)
      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
      at java.lang.Thread.run(Thread.java:534)

      Apparently Tomcat cannot get the writer from the response object, because getOutputStream() has already been called on it.

        Activity

        Hide
        Michal Borowiecki added a comment -

        The web.xml fragment I ment to paste (at the beginning of the description) was:

        <error-page>
        <error-code>404</error-code>
        <location>/error.jspx</location>
        </error-page>

        Show
        Michal Borowiecki added a comment - The web.xml fragment I ment to paste (at the beginning of the description) was: <error-page> <error-code>404</error-code> <location>/error.jspx</location> </error-page>
        Hide
        Michal Borowiecki added a comment -

        This seems to be related to ExtensionFilter.
        If I remove ExtensionFilter mapping from web.xml this issue doesn't occur. Of course tomahawk components don't work then.

        Show
        Michal Borowiecki added a comment - This seems to be related to ExtensionFilter. If I remove ExtensionFilter mapping from web.xml this issue doesn't occur. Of course tomahawk components don't work then.
        Hide
        Jeff Bischoff added a comment -

        It says status is "patch available"... but what patch? There are no files attached, nor Fix Version.

        Show
        Jeff Bischoff added a comment - It says status is "patch available"... but what patch? There are no files attached, nor Fix Version.
        Hide
        Jeff Bischoff added a comment -

        I can confirm that this error also occurs on JBoss 4.0.2 and 4.0.4GA

        Show
        Jeff Bischoff added a comment - I can confirm that this error also occurs on JBoss 4.0.2 and 4.0.4GA
        Hide
        Brooks Lyrette added a comment -

        Still an Issue in 1.1.4

        Show
        Brooks Lyrette added a comment - Still an Issue in 1.1.4

          People

          • Assignee:
            Cagatay Civici
            Reporter:
            Michal Borowiecki
          • Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:

              Development