• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Downloading file

 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 144
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic