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.
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 :P