permaculture playing cards*
The moose likes Servlets and the fly likes Downloading file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Downloading file" Watch "Downloading file" New topic
Author

Downloading file

Mark Leong
Ranch Hand

Joined: Dec 11, 2000
Posts: 60
I am trying to download files through a servlet using the classes from Jason Hunter. The webserver showed the following:-
java.lang.IllegalStateException: getOutputStream has been called on this same request
at ezj.g.a.h.getWriter(Unknown Source)
at ezj.g.a.h.sendError(Unknown Source)
at smallcon.jobcontrol.downloadfile.doPost(downloadfile.java:35)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at ezj.engines.EZServletRunner.service(Unknown Source)
at ezj.b.a.a(Unknown Source)
at ezj.b.c.handleConnection(Unknown Source)
at ezj.b.e.run(Unknown Source)
Can anybody explain what the above mean and how to solve the problem?
sridhar satuloori
Ranch Hand

Joined: Nov 05, 2001
Posts: 144
Originally posted by Mark Leong:
I am trying to download files through a servlet using the classes from Jason Hunter. The webserver showed the following:-
java.lang.IllegalStateException: getOutputStream has been called on this same request
at ezj.g.a.h.getWriter(Unknown Source)
at ezj.g.a.h.sendError(Unknown Source)
at smallcon.jobcontrol.downloadfile.doPost(downloadfile.java:35)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at ezj.engines.EZServletRunner.service(Unknown Source)
at ezj.b.a.a(Unknown Source)
at ezj.b.c.handleConnection(Unknown Source)
at ezj.b.e.run(Unknown Source)
Can anybody explain what the above mean and how to solve the problem?

Your Test case or servlet would have alread opened a PrintWriter and now it iss trying to open the Stream.
At any point of time either you can associate Writer or Stream with your response but not both. You will get IllegalstateException if u hold either Writer or Stream and try to open other.
--Sridhar
Mark Leong
Ranch Hand

Joined: Dec 11, 2000
Posts: 60
The download servlet worked on the test server. Wouldn't that make it work on the actual host?
sridhar satuloori
Ranch Hand

Joined: Nov 05, 2001
Posts: 144
can you post the test case.
what servers ypu are using for testing and hosting
Mark Leong
Ranch Hand

Joined: Dec 11, 2000
Posts: 60
I have actually placed the application at webappcabaret.net. However it has not be listed at the application directory.
The error is obtained from the log file.
For development, I run RH7.1, Java 1.3.0_02, tomcat 3.2.1.
Will make a test using tomcat 4.0.4 + Java 1.4
 
Consider Paul's rocket mass heater.
 
subject: Downloading file