Question

I am getting a servlet Exception "Stream closed" !!. I am not able to identify which jsp page is the problematic one or which line has the issue. It's showing the pagedefinition page as well as included pages.

As it is not easy to show all the pages attaching as a zip file : InGoogleDocs

The structure is like pageDef.jsp Contains : allThings.jsp design.jsp myFile.jsp

The exception I got is as follows:

javax.servlet.jsp.JspException: ServletException in '/layout/global/allThings.jsp': ServletException in '/layout/body/design.jsp': ServletException in '/layout/sub/design.jsp': ServletException in '/module/air/myFile.jsp': Stream closed at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:920) at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:460) at org.apache.jsp.pagedef.air.pageDef_jsp._jspx_meth_tiles_insert_0(pageDef_jsp.java:1693) at org.apache.jsp.pagedef.air.pageDef_jsp._jspService(pageDef_jsp.java:146) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:386) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at sun.reflect.GeneratedMethodAccessor70.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:270) at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:269) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAsPrivileged(Subject.java:517) at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:302) at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:163) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:283) at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:56)

Important Note: I am not getting this exception all the time. when I go to the page (sometimes i will get the exception). If not getting , if I click back button in the jsp and coming back to the page will make the exception.

Was it helpful?

Solution

This problem is solved.

The problem was in a JSTL custom tag library's for-loop !!

How I solved(debugging JSP): I made different copies of problematic file and included each of them in definition JSP. Each of those problematic JSP files are edited in different areas as follows. If we do so, the error will be in only one/some JSP and so it is easy to find out the exception.

Say:
problematic-ORIGINAL.jsp

<jsp:for...></jsp>
<c:...>..</c>
<a href="<c:..../>"> ... </a>

problematic-1.jsp

<c:...>..</c>

problematic-2.jsp

<jsp:for...></jsp>

problematic-3.jsp

<a href="<c:..../>"> ... </a>

And then include 1,2 and 3 in definition JSP. Thus I could find the prob was in 2nd one. Enjoy coding ..

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top