Tapestry
  1. Tapestry
  2. TAPESTRY-2415

StreamResponse does not work on WebLogic - response not flushed, and secondary exception raised

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 5.0.11, 5.0.12
    • Fix Version/s: 5.0.12
    • Component/s: tapestry-core
    • Labels:
      None
    • Environment:
      WebLogic 9.2

      Description

      It seems that Jetty 6.x and WebLogic 9.2 differ in how they handle ServletOutputStream.close().

      Jetty will flush/commit the response at this point, whereas WebLogic does not appear to. The result is that the (Tapestry) response is NOT committed when ImmediateActionRenderResponseFilter checks it. As a result, the "Sanity check - neither a stream response nor a redirect response was geenrated for this action request." IllegalStateException is raised.

      UNFORTUNATELY, the DefaultRequestExceptionHandler now kicks in and tries to render a TapestryException page. This means that the Response.getWriter() method is invoked, AFTER Response.getOutputStream() is invoked – a state deemed illegal by WebLogic (and the Servlet specification), so WebLogic raises a secondary exception that obscures the actual cause (see below).

      A FIX: add a call to os.flush() in StreamResponseResultProcessor.processResultValue(..) just before os.close().

      Not sure that there is a good solution to the secondary exception problem if there's an exception during a StreamResponse, of trying to write an error page – using getWriter() – when the output stream is already been written to, presumably with a different contentType...

      The secondary exception raised is...
      java.lang.IllegalStateException: strict servlet API: cannot call getWriter() after getOutputStream()
      at weblogic.servlet.internal.ServletResponseImpl.getWriter(ServletResponseImpl.java:286)
      at org.apache.tapestry.internal.services.ResponseImpl.getPrintWriter(ResponseImpl.java:47)
      at $Response_119dbc3d281.getPrintWriter($Response_119dbc3d281.java)
      at $Response_119dbc3d1c2.getPrintWriter($Response_119dbc3d1c2.java)
      at org.apache.tapestry.internal.services.PageResponseRendererImpl.renderPageResponse(PageResponseRendererImpl.java:59)
      at $PageResponseRenderer_119dbc3d1eb.renderPageResponse($PageResponseRenderer_119dbc3d1eb.java)
      at org.apache.tapestry.internal.services.DefaultRequestExceptionHandler.handleRequestException(DefaultRequestExceptionHandler.java:55)
      at $RequestExceptionHandler_119dbc3d1d7.handleRequestException($RequestExceptionHandler_119dbc3d1d7.java)
      at org.apache.tapestry.internal.services.RequestErrorFilter.service(RequestErrorFilter.java:41)
      at $RequestHandler_119dbc3d1da.service($RequestHandler_119dbc3d1da.java)
      at org.apache.tapestry.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:79)
      at $RequestHandler_119dbc3d1da.service($RequestHandler_119dbc3d1da.java)
      at org.apache.tapestry.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:93)
      at org.apache.tapestry.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:84)
      at org.apache.tapestry.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:75)
      at org.apache.tapestry.internal.services.CheckForUpdatesFilter.service(CheckForUpdatesFilter.java:106)
      at $RequestHandler_119dbc3d1da.service($RequestHandler_119dbc3d1da.java)
      at $RequestHandler_119dbc3d1d1.service($RequestHandler_119dbc3d1d1.java)
      at org.apache.tapestry.services.TapestryModule$11.service(TapestryModule.java:919)
      at org.apache.tapestry.internal.services.IgnoredPathsFilter.service(IgnoredPathsFilter.java:62)
      at $HttpServletRequestFilter_119dbc3d1d0.service($HttpServletRequestFilter_119dbc3d1d0.java)
      at $HttpServletRequestHandler_119dbc3d1d2.service($HttpServletRequestHandler_119dbc3d1d2.java)
      at $HttpServletRequestHandler_119dbc3d1cf.service($HttpServletRequestHandler_119dbc3d1cf.java)
      at org.apache.tapestry.TapestryFilter.doFilter(TapestryFilter.java:168)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
      at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3243)
      at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
      at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
      at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2003)
      at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1909)
      at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1359)
      at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
      at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)

        Activity

        Hide
        Howard M. Lewis Ship added a comment -

        I've added the flush() call; please get the snapshot after tonight's nightly build and see if this fixes the problem.

        Show
        Howard M. Lewis Ship added a comment - I've added the flush() call; please get the snapshot after tonight's nightly build and see if this fixes the problem.

          People

          • Assignee:
            Howard M. Lewis Ship
            Reporter:
            Philip Lopez
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development