Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: IllegalStateException getOutputStream

  1. #1
    Junior Member
    Join Date
    Jan 2011
    Thanked 0 Times in 0 Posts

    Default IllegalStateException getOutputStream

    I have tried everything I can think of or find on the web, so I'm here now to ask kindly for your help. I have a large web app on load balanced Sun Webserver7 servers. Recently we had some issues with memory usage and garbage collection so we decided to use some monitoring software to help diagnose the system and see where our problem areas are. So I installed JavaMelody on all the servers. After doing so I started getting errors when our users tried to download Excel spreadsheets from you table. We have a link that calls a servlet to produce the excel spreadsheet and then serve it up via the response.getOutputStream(). We are using the custom code to create the spreadsheet because displaytag doesn't provide the formatting we need. Anyway, After including the filter in the web.xml file for JavaMelody we get the IllegalStateException getOutputStream has already been called.

    I've looked up this error and found references to reset the output stream and/or the buffer. But none of these had any affect on the issue. The error still persists. I did find a reference to this type of error for JavaMelody but that was "supposedly" fixed a few builds ago and we are using the most current build.

    I have also tried using an exclude url pattern tag in the web.xml file to exclude the servlets in question from being filtered by the JavaMelody code but that too has not resulted in any positive results. The error still exists.

    Any ideas?



  2. #2
    Forum Squatter newbie's Avatar
    Join Date
    Nov 2010
    North Wales
    My Mood
    Thanked 115 Times in 106 Posts
    Blog Entries

    Default Re: IllegalStateException getOutputStream

    This is a stab in the dark, but
    • make sure you aren't trying to obtain more than one output stream to the same connection.
    • (Not sure)Check if your trying to get after flushing

    Good Luck
    Please use [highlight=Java]//code goes here...[/highlight] tags when posting your code