You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Xander Heemskerk <xh...@factotum.nl> on 2000/06/26 17:25:31 UTC
JSP & Servlets
Using:
Apache 1.3.12
Tomcat 3.1 on Solaris 2.6
JVM 1.2.2_5a started with native threads
We got the following problem when a servlet is used with a JSP.
The application runs OK for a while but at a certain point we the following error.
After this error both the JSP and the servlet involved don't run correctly anymore unless the JVM is restarted.
Can any one shine a light on this ?
Thanks and regards Xander Heemskerk
"
Context log: path="/memberarea" Loading -2147483646 jsp
Context log: path="/memberarea" Loading -2147483646 default
Context log: path="/memberarea" Error in jsp service() : Cannot forward as OutputStream or Writer has already been obtained
java.lang.IllegalStateException: Cannot forward as OutputStream or Writer has already been obtained
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Compiled Code)
at java.lang.RuntimeException.<init>(RuntimeException.java:47)
at java.lang.IllegalStateException.<init>(IllegalStateException.java:45)
at org.apache.tomcat.core.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:130)
at org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:357)
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:381)
at _0002fOlzdetail_0002ejspOlzdetail_jsp_5._jspService(Compiled Code)
at org.apache.jasper.runtime.HttpJspBase.service(Compiled Code)
at javax.servlet.http.HttpServlet.service(Compiled Code)
at org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(Compiled Code)
at org.apache.jasper.runtime.JspServlet.serviceJspFile(Compiled Code)
at org.apache.jasper.runtime.JspServlet.service(Compiled Code)
at javax.servlet.http.HttpServlet.service(Compiled Code)
at org.apache.tomcat.core.ServletWrapper.handleRequest(Compiled Code)
at org.apache.tomcat.core.ContextManager.service(Compiled Code)
at org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection(Compiled Code)
at org.apache.tomcat.service.TcpWorkerThread.run(Compiled Code)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(Compiled Code)
at java.lang.Thread.run(Compiled Code)
"
Re: JSP & Servlets
Posted by Rick Roberts <Ri...@va.prestige.net>.
I can reproduce the error message by using 'page include' and having the
'error page' directive on both pages.
Not sure if this applys to your case, but maybe it will give you a clue
to your problem.
Hope this helps,
Rick
<%-- page1.jsp --%>
<%@ page errorPage="error1.jsp"%>
<jsp:include page="page2.jsp" flush="true" />
<%-- page2.jsp --
this page needs to generate an error (1/0 will take care of
that)--
--%>
<%@ page errorPage="error1.jsp"%>
<%= 1/0 %>
<%-- error1.jsp --
this page is not important to you but I included it for completness
--%>
<%@ page isErrorPage="true" import="java.io.*" %>
<html>
<head>
<title>Error Page</title>
</head>
<body>
<table border="1">
<tr>
<td>Exception</td>
<td><%= exception %></td>
</tr>
<tr>
<td>Message</td>
<td><%= exception.getMessage() %></td>
</tr>
<tr>
<td>Localized Message</td>
<td><%= exception.getLocalizedMessage() %></td>
</tr>
<tr>
<td>Stack Trace</td>
<td><pre>
<%
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
exception.printStackTrace(pw);
out.println(sw);
%>
</pre></td>
</tr>
</table>
</body>
</html>