Win a copy of Rust Web Development this week in the Other Languages forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

getOutputStream() has already been called for this response

 
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm currently developing a web application using struts 1.3.5 with tiles deployed on XP under tomcat 5.5

I've implemented a download facility to enable users to download
files by clicking on appropriate links. This has been achieved
using the struts file download action mentioned at

StrutsFileDownloadAction

The application works fine, and i can download a number of different
formats including pdf, zip etc.

However Problems arise when I perform stress testing using JMeter.

The following exception is thrown

"java.lang.IllegalStateException: getOutputStream() has already been called for this response"


I have the following settings for Jmeter.

Number of Threads: 1

Ramp-up Period : 1

Loop count : 50

I'd appreciate it if anyone could enlighten me as to what is actually going on.

The code is as follows


A partial stack trace is given below


2007/7/04 17:07 40 [ERROR] org.apache.catalina.core.ApplicationDispatcher.invoke:L - Servlet.service() for servlet jsp threw exception
java.lang.IllegalStateException: getOutputStream() has already been called for this response
at org.apache.catalina.connector.Response.getWriter(Response.java:599)
at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:195)
at javax.servlet.ServletResponseWrapper.getWriter(ServletResponseWrapper.java:111)
at javax.servlet.ServletResponseWrapper.getWriter(ServletResponseWrapper.java:111)
at javax.servlet.ServletResponseWrapper.getWriter(ServletResponseWrapper.java:111)
at javax.servlet.ServletResponseWrapper.getWriter(ServletResponseWrapper.java:111)
at javax.servlet.ServletResponseWrapper.getWriter(ServletResponseWrapper.java:111)
at javax.servlet.ServletResponseWrapper.getWriter(ServletResponseWrapper.java:111)
...............................................................
...............................................................
...............................................................
at javax.servlet.ServletResponseWrapper.getWriter(ServletResponseWrapper.java:111)
at javax.servlet.ServletResponseWrapper.getWriter(ServletResponseWrapper.java:111)
at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:124)
at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:117)
at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:174)
at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:115)
at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:75)
at org.apache.jsp.WEB_002dINF.common.Layout_jsp._jspService(Layout_jsp.java:85)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
...............................................................
...............................................................
...............................................................




kind regards,

Mo
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've seen situations where this exception is thrown because the download is being done within a tiles template. One way to avoid this would be to make sure a separate window is opened when the file downloads. You can do this by specifying target="_blank" in yor form tag.
 
mo sayed
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Merrill

Thanks for the swift reply.


've seen situations where this exception is thrown because the download is being done within a tiles template. One way to avoid this would be to make sure a separate window is opened when the file downloads. You can do this by specifying target="_blank" in yor form tag.



I tried this but unfortunately I'm still getting the same error.
I'd appreciate any other suggestions you may have.

kind regards,
Mo
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by mo sayed:
Merrill

Thanks for the swift reply.



I tried this but unfortunately I'm still getting the same error.
I'd appreciate any other suggestions you may have.

kind regards,
Mo




Are you using two System.out & creating an OutputStream in your code?

I have seen this as the problem in other forums.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic