getOutputStream() has already been called for this response

A

anashri

Hi,

I am getting getOutputStream() has already been called for this
response error in jdk1.4.2 environment.
We have upgraded the sun 6.0 to 6.1, jdk1.4.1 to 1.4.2 and jwsdp1.2 to
1.6. This error is not coming in old environment.

from GUI screen sidebar - servlet is called and from servlet jsp is
included using the requestDispatcher.
From servlet requestdispatcher is called. Servlet has the
"ServletOutputStream out = res.getOutputStream();"

Is there other way to include the jsp??

servlet code :
P...InfoServlet.java : 366 and before lines ==
ServletOutputStream out = res.getOutputStream(); //at the top of do get
................................
ServletContext sc;
RequestDispatcher rd;
req.setAttribute("ic", ic);
req.setAttribute("portObj", pobj);
sc = this.getServletContext();
errmsg = URLEncoder.encode(errmsg,"ISO-8859-1");
rd =
sc.getRequestDispatcher("/PortInfoPage.jsp?rc="+rc+"&errmsg="+errmsg);
rd.include(req, res);

_PortInfoPage_jsp.java:792 ==
out.write("\n<TR>\n<TD NOWRAP ALIGN=CENTER VALIGN=MIDDLE
COLSPAN=2>\n\n<TABLE BORDER=0 FRAME=NO_FRAME RULES=ALL_RULES
ALIGN=CENTER WIDTH=\"100%\" NOWRAP>\n<TR>\n<TD NOWRAP ALIGN=RIGHT
VALIGN=MIDDLE COLSPAN=3>\nTo get the current parameter values click
here:\n</TD>\n<TD NOWRAP ALIGN=LEFT ALIGN=MIDDLE>\n<INPUT TYPE =
\"BUTTON\" NAME = \"\" VALUE=\"Refresh\"
onClick=\"refresh()\">\n</TD>\n</TR>\n ");

Here is the stack
[15/Dec/2006:23:36:15] info (12185): CORE3282: stdout: list size=2
[15/Dec/2006:23:36:16] failure (12185): for host 135.210.81.182 trying
to GET /servlet/PortInfoServlet, service-j2ee reports:
ApplicationDispatcher[] WEB2649: Servlet.service() for servlet jsp
threw exception
java.lang.IllegalStateException: WEB3024: getOutputStream() has already
been called for this response
at
org.apache.catalina.connector.ResponseBase.getWriter(ResponseBase.java:880)
at
org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:165)
at
javax.servlet.ServletResponseWrapper.getWriter(ServletResponseWrapper.java:146)
at
org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:184)
at
org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:176)
at
org.apache.jasper.runtime.JspWriterImpl.write(JspWriterImpl.java:389)
at
org.apache.jasper.runtime.JspWriterImpl.write(JspWriterImpl.java:401)
at _jsps._PortInfoPage_jsp._jspService(_PortInfoPage_jsp.java:792)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:908)
at
com.iplanet.ias.web.jsp.JspServlet$JspServletWrapper.service(JspServlet.java:687)
at
com.iplanet.ias.web.jsp.JspServlet.serviceJspFile(JspServlet.java:459)
at com.iplanet.ias.web.jsp.JspServlet.service(JspServlet.java:375)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:908)
at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:772)
at
org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:628)
at
org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:539)
at PortInfoServlet.doGet(PortInfoServlet.java:366)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:787)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:908)
at
org.apache.catalina.core.StandardWrapperValve.invokeServletService(StandardWrapperValve.java:771)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:322)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:218)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:209)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
at
com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:157)
at com.iplanet.ias.web.WebContainer.service(WebContainer.java:579)
 
A

anashri

Issue was compiled jsp was using automatically getWriter.

Once servlet code used the getWriter, issue resolved.


Hi,

I am getting getOutputStream() has already been called for this
response error in jdk1.4.2 environment.
We have upgraded the sun 6.0 to 6.1, jdk1.4.1 to 1.4.2 and jwsdp1.2 to
1.6. This error is not coming in old environment.

from GUI screen sidebar - servlet is called and from servlet jsp is
included using the requestDispatcher.
From servlet requestdispatcher is called. Servlet has the
"ServletOutputStream out = res.getOutputStream();"

Is there other way to include the jsp??

servlet code :
P...InfoServlet.java : 366 and before lines ==
ServletOutputStream out = res.getOutputStream(); //at the top of do get
...............................
ServletContext sc;
RequestDispatcher rd;
req.setAttribute("ic", ic);
req.setAttribute("portObj", pobj);
sc = this.getServletContext();
errmsg = URLEncoder.encode(errmsg,"ISO-8859-1");
rd =
sc.getRequestDispatcher("/PortInfoPage.jsp?rc="+rc+"&errmsg="+errmsg);
rd.include(req, res);

_PortInfoPage_jsp.java:792 ==
out.write("\n<TR>\n<TD NOWRAP ALIGN=CENTER VALIGN=MIDDLE
COLSPAN=2>\n\n<TABLE BORDER=0 FRAME=NO_FRAME RULES=ALL_RULES
ALIGN=CENTER WIDTH=\"100%\" NOWRAP>\n<TR>\n<TD NOWRAP ALIGN=RIGHT
VALIGN=MIDDLE COLSPAN=3>\nTo get the current parameter values click
here:\n</TD>\n<TD NOWRAP ALIGN=LEFT ALIGN=MIDDLE>\n<INPUT TYPE =
\"BUTTON\" NAME = \"\" VALUE=\"Refresh\"
onClick=\"refresh()\">\n</TD>\n</TR>\n ");

Here is the stack
[15/Dec/2006:23:36:15] info (12185): CORE3282: stdout: list size=2
[15/Dec/2006:23:36:16] failure (12185): for host 135.210.81.182 trying
to GET /servlet/PortInfoServlet, service-j2ee reports:
ApplicationDispatcher[] WEB2649: Servlet.service() for servlet jsp
threw exception
java.lang.IllegalStateException: WEB3024: getOutputStream() has already
been called for this response
at
org.apache.catalina.connector.ResponseBase.getWriter(ResponseBase.java:880)
at
org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:165)
at
javax.servlet.ServletResponseWrapper.getWriter(ServletResponseWrapper.java:146)
at
org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:184)
at
org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:176)
at
org.apache.jasper.runtime.JspWriterImpl.write(JspWriterImpl.java:389)
at
org.apache.jasper.runtime.JspWriterImpl.write(JspWriterImpl.java:401)
at _jsps._PortInfoPage_jsp._jspService(_PortInfoPage_jsp.java:792)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:908)
at
com.iplanet.ias.web.jsp.JspServlet$JspServletWrapper.service(JspServlet.java:687)
at
com.iplanet.ias.web.jsp.JspServlet.serviceJspFile(JspServlet.java:459)
at com.iplanet.ias.web.jsp.JspServlet.service(JspServlet.java:375)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:908)
at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:772)
at
org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:628)
at
org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:539)
at PortInfoServlet.doGet(PortInfoServlet.java:366)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:787)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:908)
at
org.apache.catalina.core.StandardWrapperValve.invokeServletService(StandardWrapperValve.java:771)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:322)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:218)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:209)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
at
com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:157)
at com.iplanet.ias.web.WebContainer.service(WebContainer.java:579)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top