aspose file tools*
The moose likes I/O and Streams and the fly likes getOutputStream() has already been called for this response Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "getOutputStream() has already been called for this response" Watch "getOutputStream() has already been called for this response" New topic
Author

getOutputStream() has already been called for this response

Kevin Valencia
Greenhorn

Joined: Aug 20, 2007
Posts: 18
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

Joined: Aug 20, 2007
Posts: 18
by the way, the code above is placed in my action class..
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8893
    
    8

Does your Action class return an ActionForward? That will attempt to write more data to the output stream.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Kevin Valencia
Greenhorn

Joined: Aug 20, 2007
Posts: 18
Thanks Joe! Removing the actionforward solved it, wasnt aware it had something to do with the stream! Thanks a bunch...
Rahul Nair
Ranch Hand

Joined: Dec 01, 2007
Posts: 138
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

Joined: Dec 01, 2007
Posts: 138
Originally posted by Rahul Nair:


Hello Joe Ess,
Thanks for replying. removing ActionForward solved my issue.
Stephanie Johnson
Greenhorn

Joined: Jun 03, 2009
Posts: 8
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

Joined: Jun 10, 2009
Posts: 2
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: getOutputStream() has already been called for this response