getOutputStream() has already been called for this response

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 servlet requestdispatcher is called. Servlet has the "ServletOutputStream out = res.getOutputStream();"

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)

[4219 byte] By [indian_511a] at [2007-11-26 12:47:01]
# 1
HI,this issue is resolved. For some reason the auto compiled jsp has used the JspWriter.And now when we take out the getOutputStream from the servlet and use the PrintWriter then it works.thanks
indian_511a at 2007-7-7 16:28:11 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...