Reputation: 1
I have deployed my application on weblogic 12c server. I'm seeing response already committed
error pointing to the out.clear();
line. Not sure on why I'm facing this problem with only weblogic server - works fine with tomcat.
Below is the code snippet. Any help would be appreciated! Thank you.
request.getRequestDispatcher(toolbarURL.toString()).include(request, customResponse);
Element toolbarCode = new Element("toolbarCode");
toolbarCode.setContent(new CDATA(customResponse.getOutput()));
root.addContent(toolbarCode);
XMLOutputter outputter = new XMLOutputter(format);
out.clear();
outputter.output(new DocType("html"), out);
outputter.output(transformer.transform(doc), out);
The line out.clear();
is the one throwing the exception.
Upvotes: 0
Views: 1296
Reputation: 78905
You don't show the declaration of out
but I assume it is a JSPWriter
instance. Therefore, your code relies on some implementation dependent behavior of servlet containers, namely how quickly they flush the output. Once the first byte has been flushed (sent downstream towards the client), clear
may no longer be called (see documentation.
Clear the contents of the buffer. If the buffer has been already been flushed then the clear operation shall throw an IOException to signal the fact that some data has already been irrevocably written to the client response stream.
WebLogic 12c is probably more aggressive at flushing output than Tomcat. Therefore, it is no longer okay to clear the buffer.
Most likely, you can just remove the line out.clear();
to fix it.
Upvotes: 1