You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Gl...@flagstar.com on 2000/05/12 23:02:41 UTC
MultipartRequest on Tomcat 3.1
I'm having a problem with file uploading in a Tomcat 3.1 environment
(Tomcat is being used as the web server as well as the JSP engine). I
have written a wrapper class for the MultipartRequest class
(com.oreilley.servlet.MultipartRequest) which contains a method to initiate
the upload. This method instantiates an instance of the MultipartRequest
class to perform the actual upload. The wrapper class is being used as a
bean within a JSP page - sample code below:
<html><head></head><body>
Testing ResumeUpload Bean<br>
<br>
<jsp:useBean id="ru" class="com.flagstar.consumer.hr.ResumeUpload"
scope="request"/>
<jsp:setProperty name="ru" property="maxFileSize" value="512000" />
Sending...<br>
<%
boolean uploaded = ru.send(request);
%>
Sent.<br>
<%
if (uploaded) {
%>
<br>File successfully uploaded.<br>
<%
}
else {
%>
<br>File upload failed (Error: <%=ru.getErrorMessage()%>)<br>
<% }
%>
</body>
</html>
This code works fine on JavaWebServer 2.0, but when I attempt to run it on
Tomcat 3.1, I get the following output:
Testing ResumeUpload Bean
Sending...
Error: 500
Location: /ResumeUpload.jsp
Internal Servlet Error:
java.lang.IllegalStateException: Response has already been committed
at
org.apache.tomcat.core.HttpServletResponseFacade.sendError(HttpServletRespo
nseFacade.java, Compiled Code)
at
org.apache.jasper.runtime.JspServlet.unknownException(JspServlet.java:299)
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.http.HttpConnectionHandler.processConnection(Http
ConnectionHandler.java, Compiled Code)
at
org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java,
Compiled Code)
at java.lang.Thread.run(Thread.java, Compiled Code)
It appears that something is happening to make Tomcat think that the
response has already been sent back to the client
by the time the method call returns control to the JSP. Any insight into
this would be greatly appreciated.
Thanks,
Glenn Brauser
glenn.brauser@flagstar.com