(longish, please read if you're familiar with Jasper sources) I'm using Jasper which comes packaged with JBoss 3.0. One of the JSPs has the following code:
BodyContent bc = pageContext.pushBody(); request.getRequestDispatcher(jspName).forward(request, response); pageContext.popBody(); wc.writeOut(new FileWriter(...)); I am using this to generate a bunch of files on disk. At the bottom of the including page, I get the following error: java.lang.ClassCastException: org.apache.jasper.runtime.BodyContentImpl at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:174) at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:198) at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:193) at org.apache.jsp.generate$jsp._jspService(generate$jsp.java:552) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107) <snip> This is the cleanup code at the bottom of the JSP (generate$jsp.java): } catch (Throwable t) { if (out != null && out.getBufferSize() != 0) out.clearBuffer(); if (pageContext != null) pageContext.handlePageException(t); } finally { 552: if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext); } ... and this is the Jasper code where it happens (PageContextImpl.java): public void release() { out = baseOut; try { if (isIncluded) { 174: ((JspWriterImpl)out).flushBuffer(); // push it into the including jspWriter } else { out.flush(); } } catch (IOException ex) { loghelper.log("Internal error flushing the buffer in release()"); } It seems that after the popBody() in the JSP, out is no longer of class JspWriterImpl with makes the cast fail. To be sure, my use of the BodyContent is somewhat creative, but I'm not aware that I'm breaking any J2EE contract. Also, my code works just fine under WebLogic. Would it make sense to check instanceof JspWriterImpl on line 173? Or am I missing something? Any hint is appreciated -- Joel -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>