getOutputStream() has already been called for this response

Discussion in 'Java' started by anashri@gmail.com, Dec 17, 2006.

  1. Guest

    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)
     
    , Dec 17, 2006
    #1
    1. Advertising

  2. Guest

    Issue was compiled jsp was using automatically getWriter.

    Once servlet code used the getWriter, issue resolved.


    wrote:
    > 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)
     
    , Dec 18, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. micky
    Replies:
    0
    Views:
    1,400
    micky
    Dec 20, 2005
  2. Zaphod
    Replies:
    3
    Views:
    9,082
    Arnaud Berger
    Mar 18, 2005
  3. Replies:
    0
    Views:
    687
  4. Guest
    Replies:
    2
    Views:
    5,577
    wwwtar
    Nov 2, 2006
  5. PritishS
    Replies:
    0
    Views:
    927
    PritishS
    Apr 10, 2010
Loading...

Share This Page