You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@jakarta.apache.org by Matjaz Trtnik <ma...@portal.si> on 2000/12/25 00:37:59 UTC

Cannot forward as OutputStream or Writer has already been obtained

Hello!

I get this strangeproblem from time totime when executing my JSP:

Error: 500
Location: /zminutka/tp/tp.jsp
Internal Servlet Error:

java.lang.IllegalStateException: Cannot forward as OutputStream or Writer
has already been obtained
	at
org.apache.tomcat.core.RequestDispatcherImpl.forward(RequestDispatcherImpl.j
ava, Compiled Code)
	at org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java,
Compiled Code)
	at
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
l.java, Compiled Code)
	at
tp._0002ftp_0002ftp_0002ejsptp_jsp_0._jspService(_0002ftp_0002ftp_0002ejsptp
_jsp_0.java:635)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java, Compiled
Code)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled Code)
	at
org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.ja
va, Compiled Code)
	at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java,
Compiled Code)
	at org.apache.jasper.runtime.JspServlet.service(JspServlet.java, Compiled
Code)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled Code)
	at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java,
Compiled Code)
	at org.apache.tomcat.core.ContextManager.service(ContextManager.java,
Compiled Code)
	at
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection
(Ajp12ConnectionHandler.java, Compiled Code)
	at
org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java,
Compiled Code)
	at java.lang.Thread.run(Thread.java, Compiled Code)


Nothing is wrong with JSP because sometimes works just fine and sometimes it
gives me this error. When I reload it it works fine again.
Anyone have some ideas why I am getting this error from time to time? Iam
using apache+tomcat on FreeBSD.

Regards,
Matjaz



Re: Cannot forward as OutputStream or Writer has already been obtained

Posted by Willie Wheeler <ww...@andrew.cmu.edu>.
Hi Matjaz,

	Yeah, once you write any output to the output stream, even writing
headers, you can't forward any longer.  You probably have some kind of
conditional write going on before your forward.  In those cases where the
condition succeeds, you get the exception.

	Willie


On Mon, 25 Dec 2000, [ISO-8859-1] Matjaz Trtnik wrote:

> Hello!
> 
> I get this strangeproblem from time totime when executing my JSP:
> 
> Error: 500
> Location: /zminutka/tp/tp.jsp
> Internal Servlet Error:
> 
> java.lang.IllegalStateException: Cannot forward as OutputStream or Writer
> has already been obtained
> 	at
> org.apache.tomcat.core.RequestDispatcherImpl.forward(RequestDispatcherImpl.j
> ava, Compiled Code)
> 	at org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java,
> Compiled Code)
> 	at
> org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
> l.java, Compiled Code)
> 	at
> tp._0002ftp_0002ftp_0002ejsptp_jsp_0._jspService(_0002ftp_0002ftp_0002ejsptp
> _jsp_0.java:635)
> 	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java, Compiled
> Code)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled Code)
> 	at
> org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.ja
> va, Compiled Code)
> 	at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java,
> Compiled Code)
> 	at org.apache.jasper.runtime.JspServlet.service(JspServlet.java, Compiled
> Code)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled Code)
> 	at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java,
> Compiled Code)
> 	at org.apache.tomcat.core.ContextManager.service(ContextManager.java,
> Compiled Code)
> 	at
> org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection
> (Ajp12ConnectionHandler.java, Compiled Code)
> 	at
> org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java,
> Compiled Code)
> 	at java.lang.Thread.run(Thread.java, Compiled Code)
> 
> 
> Nothing is wrong with JSP because sometimes works just fine and sometimes it
> gives me this error. When I reload it it works fine again.
> Anyone have some ideas why I am getting this error from time to time? Iam
> using apache+tomcat on FreeBSD.
> 
> Regards,
> Matjaz
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: general-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: general-help@jakarta.apache.org
> 
>