Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Downloading file

 
Mark Leong
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 144
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The download servlet worked on the test server. Wouldn't that make it work on the actual host?
 
sridhar satuloori
Ranch Hand
Posts: 144
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you post the test case.
what servers ypu are using for testing and hosting
 
Mark Leong
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic