You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by "Enzo M." <en...@gmail.com> on 2020/01/21 16:51:23 UTC

javax.servlet.jsp.JspException: IO Error: Stream closed

We have a legacy application based on JSP pages that use Custom Tags. The
custom tags extends javax.servlet.jsp.tagext.BodyTagSupport

This application worked fine for years on JBoss, but now we migrated to
Tomcat and the same code throws the following exception:

"javax.servlet.jsp.JspException: IO Error: Stream closed"

on Repetition.doEndTag() line marked below:

public int doEndTag() throws JspException {

try {
if (bodyContent != null) {
/* Stream Closed here => */
bodyContent.writeOut(bodyContent.getEnclosingWriter());
bodyContent.clearBody();
}
}
catch (IOException e) {
throw new JspException("IO Error: " + e.getLocalizedMessage());
}
finally {
cleanup();
}

return EVAL_PAGE;

}

Any ideas? We tried different versions of Tomcat (8.5.24, 8.5.47, 9.0.27)
as well as different versions of jsp-api.jar and servlet-api.jar but the
problem still there.

Thanks

Re: javax.servlet.jsp.JspException: IO Error: Stream closed

Posted by Stuart Thiel <st...@gmail.com>.
Hello,

It sounds like you're probably used a forward to get to one of the
things instead of an include. When the forward is done, the stream is
closed. JBoss may not have enforced that, but in my experience Tomcat
does (as it should).

Alternatively, you have something that's explicitly closing the
writer, but that would likely have caused a problem for JBoss as well.

On Tue, Jan 21, 2020 at 11:51 AM Enzo M. <en...@gmail.com> wrote:
>
> We have a legacy application based on JSP pages that use Custom Tags. The
> custom tags extends javax.servlet.jsp.tagext.BodyTagSupport
>
> This application worked fine for years on JBoss, but now we migrated to
> Tomcat and the same code throws the following exception:
>
> "javax.servlet.jsp.JspException: IO Error: Stream closed"
>
> on Repetition.doEndTag() line marked below:
>
> public int doEndTag() throws JspException {
>
> try {
> if (bodyContent != null) {
> /* Stream Closed here => */
> bodyContent.writeOut(bodyContent.getEnclosingWriter());
> bodyContent.clearBody();
> }
> }
> catch (IOException e) {
> throw new JspException("IO Error: " + e.getLocalizedMessage());
> }
> finally {
> cleanup();
> }
>
> return EVAL_PAGE;
>
> }
>
> Any ideas? We tried different versions of Tomcat (8.5.24, 8.5.47, 9.0.27)
> as well as different versions of jsp-api.jar and servlet-api.jar but the
> problem still there.
>
> Thanks



-- 
Stuart Thiel, P. Eng.

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@tomcat.apache.org
For additional commands, e-mail: taglibs-user-help@tomcat.apache.org