I suspect the problem is your use of the include method.
You need to be quite careful about flushing stuff to the output stream...
(include() may cause this)
If you then get an error in a JSP page, the page processor tries to output a
meaningful error but tries to do first discard the outputstream that has
already been built up so that you get a clean error page. If the o/s has
already been flushed then you will get a secondary IllegalStateException
caused by the page processor's trying to mess with the outputstream. In all
of this the error message and stacks that will lead you to where the first
error is gets lost.
So I suggest you can back the includes/forwards and try some unit testing on
the individual elements.
-----Original Message-----
From: Abid Ali Teepo
To: Tomcat Users List
Sent: 13/07/2003 11:56
Subject: SV: Exception:getOutputStream() has already been called for this
response
Yes, i'm using 4.1.24 .... how come ???
Abid
-----Opprinnelig melding-----
Fra: Tim Funk [mailto:[EMAIL PROTECTED]
Sendt: fr 11.07.2003 18:06
Til: Tomcat Users List
Kopi:
Emne: Re: Exception:getOutputStream() has already been called
for this response
Doh! I don't see anything obvious from my point of view. My last
chance
question (then I'm out of ideas for now): Are you using 4.1.24?
-Tim
Abid Ali Teepo wrote:
> Hi Tim
>
> No, the rd.include doesn't write anything.
>
> I'm pasting the root cause stack trace that refers to line
number 69 in my jasper produced file that i'm attaching ... sure hope
you can have a look at it ...
>
> Abid
>
> java.lang.IllegalStateException: getOutputStream() has already
been called for this response
> at
org.apache.coyote.tomcat4.CoyoteResponse.getWriter(CoyoteResponse.java:6
14)
> at
org.apache.coyote.tomcat4.CoyoteResponseFacade.getWriter(CoyoteResponseF
acade.java:173)
> at
org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:173)
> at
org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:1
66)
> at
org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:1
84)
> at
org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspF
actoryImpl.java:198)
> at
org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryIm
pl.java:193)
> at
org.apache.jsp.netbid_done_jsp._jspService(netbid_done_jsp.java:69)
> at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
> at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>
> -----Original Message-----
> From: Tim Funk [mailto:[EMAIL PROTECTED]
> Sent: 11. juli 2003 17:49
> To: Tomcat Users List
> Subject: Re: Exception:getOutputStream() has already been
called for
> this response
>
>
> Does "rd.include(request, response);" do anything?
>
> What will really help is to look at the stacktraces produced -
then go back
> to the jasper generated files to get a better idea of
narrowing down when the
> excpetion gets thrown.
>
> -Tim
>
> Abid Ali Teepo wrote:
>
>>I don't understand Tim
>>
>>As far as i can see, i make no call to getOutputStream()
>>
>>And how come the exact same jsp-page will forward to my
"menu.jsp" but not to "safe.html". When i request the latter i get this
exception.
>>
>>Here is my JSP :
>><%@ page import="Bid.BidSession"%>
>><%
>> BidSession bidSession = BidSession.readParameters(request,
"AUTHCLIENT");
>> RequestDispatcher rd =
request.getRequestDispatcher("BidProxy");
>> rd.include(request, response);
>> session.setAttribute("bid.authenticated",new
String("true"));
>>
>> String pageWanted =
(String)session.getAttribute("bid.pageWanted");
>>
>> if(pageWanted!=null && !"".equals(pageWanted)) {
>> System.out.println("PageWanted in netbid_done:"
+pageWanted);
>> rd = request.getRequestDispatcher(pageWanted);
>> rd.forward(request, response);
>> } else {
>> rd =
request.getRequestDispatcher("/secure/menu.jsp");
>> rd.forward(request, response);
>> }
>>%>
>>
>>Could you please pinpoint my error ?
>>
>>Abid
>>
>>
>>-----Original Message-----
>>From: Tim Funk [mailto:[EMAIL PROTECTED]
>>Sent: 11. juli 2003 17:13
>>To: Tomcat Users List
>>Subject: Re: Exception:getOutputStream() has already been
called for
>>this response
>>
>>
>>You have code which is getting the response's output stream,
then NOT using it.
>>
>>Then your JSP is trying to gett the writer.
>>
>>You can get one or the other, not both.
>>
>>-Tim
>>
>>Abid Ali Teepo wrote:
>>
>>
>>>Hi
>>>
>>>Anyone recognize this exception :
>>>
>>>org.apache.jasper.JasperException: getOutputStream() has
already been called for this response
>>>
>>>I get this exception when using requestDispatcher to forward
to a
>>>html file. The exact same code works when i forward to a jsp
file ??
>>>
>>>Here is some code :
>>>pageWanted is "/secure/safe.html"
>>>
>>>if(pageWanted!=null && !"".equals(pageWanted)) {
>>> rd = request.getRequestDispatcher(pageWanted);
>>> rd.forward(request, response);
>>> } else {
>>> rd = request.getRequestDispatcher("/secure/menu.jsp");
>>> rd.forward(request, response);
>>> }
>>>
>>>Any suggestions ?
>>>
>>>Abid
>
---------------------------------------------------------------------
To unsubscribe, e-mail:
[EMAIL PROTECTED]
For additional commands, e-mail:
[EMAIL PROTECTED]
_____________________________________________________________________
This e-mail has been scanned for viruses by MessageLabs.
_____________________________________________________________________
This e-mail has been scanned for viruses by MessageLabs.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]