Sorry for my bad English. Sources: 1. $Header: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/ runtime/PageContextImpl.java,v 1.52 2003/09/02 21:39:59 remm Exp $ $Revision: 1.52 $ $Date: 2003/09/02 21:39:59 $ 2. $Header: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/ catalina/core/ApplicationDispatcher.java,v 1.26 2003/09/12 17:04:12 remm Exp $ $Revision: 1.26 $ $Date: 2003/09/12 17:04:12 $ Steps To Reproduce: 1. Create four JSP: --------------------------------------------------------- ------------------------- 1.jsp ------------------------- <%@ page import="java.util.Vector"%> <%@ page errorPage="error.jsp" %> <%@ taglib prefix="logic" uri="/WEB-INF/tlds/struts-logic.tld" %> CONTENT PAGE 1 <% // SOME COLLECTION Vector someCollection1 = new Vector(1); someCollection1.add("some value"); %> <%-- Some EVAL_BODY_BUFFERED tag --%> <logic:iterate id="some_id_1" collection="<%= someCollection1 %>" > <jsp:include page="2.jsp" /> </logic:iterate> CONTENT PAGE 1 --------------------------------------------------------- ------------------------- 2.jsp ------------------------- <%@ page import="java.util.Vector"%> <%@ page errorPage="error.jsp" %> <%@ taglib prefix="logic" uri="/WEB-INF/tlds/struts-logic.tld" %> CONTENT PAGE 2 <% Vector someCollection2 = new Vector(1); someCollection2.add("some value"); %> <%-- Some EVAL_BODY_BUFFERED tag --%> <logic:iterate id="some_id_2" collection="<%= someCollection2 %>" ><% // Some throwable statment if(request.getParameter("not exist parameter") == null) throw new Exception(); %></logic:iterate> CONTENT PAGE 2 --------------------------------------------------------- ------------------------- 3.jsp ------------------------- <%@ page import="java.util.Vector"%> <%@ taglib prefix="logic" uri="/WEB-INF/tlds/struts-logic.tld" %> <% Vector someCollection3 = new Vector(1); someCollection3.add("some value"); %> <%-- Some EVAL_BODY_BUFFERED tag --%> <logic:iterate id="some_id_3" collection="<%= someCollection3 %>" > CONTENT PAGE 3 </logic:iterate> --------------------------------------------------------- ----------------------- error.jsp ----------------------- <%@ page import="java.io.PrintWriter"%> <%@ page isErrorPage="true" %> <pre> <% PrintWriter pw; pw = new PrintWriter(out); Exception exc; exc = pageContext.getException(); if(exc != null) exc.printStackTrace(pw); %> </pre> --------------------------------------------------------- 2. Deploy application. 3. Open 1.jsp. We receive a IOException instead of Exception from 2.jsp. 3. Open 3.jsp. We receive a IOException though should not receive exception. WHY: When thrown wxceptoin on 2.jsp into ApplicationDispatcher in 465 line was closes writer. Stack trace: org.apache.jasper.catalina.core.ApplicationDispatcher.doForward():465 org.apache.jasper.catalina.core.ApplicationDispatcher.forward():359 org.apache.jasper.runtime.PageContextImpl.forward():543 org.apache.jasper.runtime.PageContextImpl.handlePageException():633 org.apache.jsp._2_jsp._jspService(): if (pageContext != null) pageContext. handlePageException(t); Later at use EVAL_BODY_BUFFERED tags called method pushBody, which returns closed writer. This is reason of IOExceptions. Closed writer - is outs[depth] from PageContextImpl. Possible, condition into PageContextImpl.pushBody in line 557 must be: if (depth >= outs.length || IS_CLOSED(outs[depth])), instead of if (depth >= outs.length).
Created attachment 15242 [details] 1.jsp
Created attachment 15243 [details] 2.jsp
Created attachment 15244 [details] 3.jsp
Created attachment 15245 [details] error.jsp
Necessary conditions: 1. Using custom errorPage 2. Using custom tags, which returned EVAL_BODY_BUFFERED from doStartTag(). 3. Using tag jsp:include.
IOEcxeption stack trace: java.io.IOException: Stream closed at org.apache.jasper.runtime.BodyContentImpl.ensureOpen(BodyContentImpl.java: 624) at org.apache.jasper.runtime.BodyContentImpl.write(BodyContentImpl.java:179) at org.apache.jasper.runtime.BodyContentImpl.write(BodyContentImpl.java:196) at org.apache.jsp._1_jsp._jspService(_1_jsp.java:79) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java: 210) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at org.apache.catalina.core.ApplicationFilterChain. internalDoFilter(ApplicationFilterChain.java:284) at org.apache.catalina.core.ApplicationFilterChain. doFilter(ApplicationFilterChain.java:204) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve. java:256) at org.apache.catalina.core.StandardValveContext. invokeNext(StandardValveContext.java:151) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:563) at org.apache.catalina.core.StandardContextValve. invokeInternal(StandardContextValve.java:245) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve. java:199) at org.apache.catalina.core.StandardValveContext. invokeNext(StandardValveContext.java:151) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:563) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:195) at org.apache.catalina.core.StandardValveContext. invokeNext(StandardValveContext.java:151) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164) at org.apache.catalina.core.StandardValveContext. invokeNext(StandardValveContext.java:149) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:563) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java: 156) at org.apache.catalina.core.StandardValveContext. invokeNext(StandardValveContext.java:151) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:563) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972) at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:209) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:670) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler. processConnection(Http11Protocol.java:517) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:575) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool. java:666) at java.lang.Thread.run(Thread.java:534)
Check bug# 33810. Try with 5.0.30 version and see if your problem goes away.
Assuming problem did go away, since no response given by original poster.
(In reply to comment #8) > Assuming problem did go away, since no response given by original poster. Problem is go away. But the bug is exist in Tomcat 5.0.28. Also the bug is exist in Tomcat 5.5.9. But it is not so critical. 1. JSP is used. 2. Deploy application. 3. Open 1.jsp. We receive a IOException instead of Exception from 2.jsp. 4. Open 3.jsp. We receive content of 3.jsp.
Please do not reopen the report. This issue will not be fixed in 5.0.28 (obviously), and does not exist in 5.5.x code.
(In reply to comment #10) > Please do not reopen the report. This issue will not be fixed in 5.0.28 > (obviously), and does not exist in 5.5.x code. Sorry. Tomcat 5.5.9 is not contan this bug.