tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marco Gonnelli <marco.gonne...@mailandnews.com>
Subject java.lang.IllegalStateException: getOutputStream() has already been called for this response while attempting a download
Date Thu, 03 Jan 2002 04:02:41 GMT
Hello tomcat-user-faq,

i'm pretty new to mailing list so i hope you'll forgive me if i made
some mistake.
As in subject the question is about troubles in downloading from a
database.
My configuration is:
Tomcat running stand-alone
MySql as database
mm.mysql-2.0.7 as jdbc driver
windows as o.s.
JspSmartUpload as upload-download package

The very headhache is that i wrote a jsp looking for a document in a
table and downloading it. The jsp works fine untill 30/12/2001 then it
started returning the following dump

A Servlet Exception Has Occurred
java.lang.IllegalStateException: getOutputStream() has already been called for this response
        at org.apache.catalina.connector.ResponseBase.getWriter(ResponseBase.java:686)
        at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:127)
        at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:166)
        at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:158)
        at org.apache.jasper.runtime.JspWriterImpl.flush(JspWriterImpl.java:205)
        at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:176)
        at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:198)
        at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:193)
        at org.apache.jsp.download$jsp._jspService(download$jsp.java:232)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:1264)
        at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:201)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:1264)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:215)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2366)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:163)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1005)
        at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1098)
        at java.lang.Thread.run(Unknown Source)

I tryed every thing to figure out the cause of this, but even
enclosing the whole jsp in a try-catch i could not get more info.
So i clean out as much code as i could and i reach a point: the first
of the following code excerpt worked for some time (now it doesn't
work too) and the second didn't work why?

<%@ page import="java.sql.*" %>
<%@ page import="com.jspsmart.upload.*" %>
<jsp:useBean id="mySmartUpload" scope="page"
class="com.jspsmart.upload.SmartUpload" />
<%
    String URL = "jdbc:mysql://localhost/xxxxxxx";
    Class.forName("org.gjt.mm.mysql.Driver");
    Connection db = DriverManager.getConnection
(URL,"xxxxxx","xxxxxxx");
    Statement stmt=db.createStatement (ResultSet.TYPE_FORWARD_ONLY
,ResultSet.CONCUR_UPDATABLE);
    ResultSet rs;
    String SQL;
    rs = stmt.executeQuery ("SELECT contenuto FROM documenti);
    rs.last();
    mySmartUpload.initialize(pageContext);
    mySmartUpload.downloadField(rs,"contenuto","text","name");
%>




<%@ page import="java.sql.*" %>
<%@ page import="com.jspsmart.upload.*" %>
<jsp:useBean id="mySmartUpload" scope="page"
class="com.jspsmart.upload.SmartUpload" />
<%
    String URL = "jdbc:mysql://localhost/xxxxxxx";
    Class.forName("org.gjt.mm.mysql.Driver");
    Connection db = DriverManager.getConnection
(URL,"xxxxxx","xxxxxxx");
    Statement stmt=db.createStatement (ResultSet.TYPE_FORWARD_ONLY
,ResultSet.CONCUR_UPDATABLE);
    ResultSet rs;
    String SQL;
    rs = stmt.executeQuery ("SELECT contenuto FROM documenti where
uid='1'");
    rs.next();
    mySmartUpload.initialize(pageContext);
    mySmartUpload.downloadField(rs,"contenuto","text","name");
%>



-- 
Best regards,
 Marco                          mailto:marco.gonnelli@mailandnews.com



--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message