Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getOutputStream() has already been called for this response

 
Kevin Valencia
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello..
I've googled this error and have seen a lot of solutions pertaining to response.getOutputStream() being called multiple times, but i dont really see this happening in my code or in the jsp.. I'm trying to download a file that is retrieved from the database as blob. The code below will show that after the blob is retrieved, it will write the file then allow the client to download this file. I've successfuly done this and the file gets downloaded, however in the tomcat console, this error appears. What could be wrong?
Would really appreciate your help.
Thanks in advance.

 
Kevin Valencia
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
by the way, the code above is placed in my action class..
 
Joe Ess
Bartender
Posts: 9302
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does your Action class return an ActionForward? That will attempt to write more data to the output stream.
 
Kevin Valencia
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Joe! Removing the actionforward solved it, wasnt aware it had something to do with the stream! Thanks a bunch...
 
Rahul Nair
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Joe Ess:
Does your Action class return an ActionForward? That will attempt to write more data to the output stream.


Hello Joe Ess,
Thanks for replying.
 
Rahul Nair
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Rahul Nair:


Hello Joe Ess,
Thanks for replying. removing ActionForward solved my issue.
 
Stephanie Johnson
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like to know what you mean When you say remove ActionForward ?
Do you set ActionForward to null - I am still getting the exception if I set it to null.
 
Romulo F. Freitas
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stephanie Johnson wrote:I would like to know what you mean When you say remove ActionForward ?
Do you set ActionForward to null - I am still getting the exception if I set it to null.

Change your method signature. Remove type ActionForward from return and use void

something like this. from:
public ActionForward methodName
to:
public void methodName
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic