Ravi Gupta
Ravi Gupta

Reputation: 4574

What harm is caused by java.lang.IllegalStateException: Response already committed

I continuously get below error on my weblogic 10.3 console logs

java.lang.IllegalStateException: Response already committed
at weblogic.servlet.internal.ServletResponseImpl.objectIfCommitted(ServletResponseImpl.java:
1462)
at weblogic.servlet.internal.ServletResponseImpl.sendError(ServletResponseImpl.java:601)
at org.apache.struts.action.RequestProcessor.processMapping(RequestProcessor.java:658)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:193)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)

Truncated. see log file for complete stacktrace

I was wondering what harm is caused by this if left unfixed ? This error has been in my app before I joined the team, is this serious enough to qualify as "Needs immediate fix" ?

Upvotes: 6

Views: 30373

Answers (3)

BalusC
BalusC

Reputation: 1109142

Struts is open source. Just check the RequestProcessor source prior to line 658 (as noted in stacktrace):

// No mapping can be found to process this request
String msg = getInternal().getMessage("processInvalid", path);
log.error(msg);
response.sendError(HttpServletResponse.SC_NOT_FOUND, msg);

See the comment: No mapping can be found to process this request. That's the root cause of the problem. But the sendError() call to display an error message cannot be completed as well, because the response is already committed. Apparently there are two things a failure: there's a mapping missing and the default work of Struts mapping has been taken over programmatically in an incorrect manner.

Upvotes: 11

Mike Tunnicliffe
Mike Tunnicliffe

Reputation: 10772

It depends, the meaning of the error is that you have written to your HttpResponse object and started to send the response (by calling flush(), sendError() or sendRedirect()) so potentially any additions to the response stream (or headers etc) or indeed the subsequent action (for example, you called flush() and now you're calling sendError()) requested will be lost.

Upvotes: 0

perdian
perdian

Reputation: 2843

It means that the application tried to send an HTTP header after the response has been sent. What kind of harm this does depends on the application.

Most of the time a missing HTTP header can be tolerated by the browser but, for example, if you want to specify a special Content-Type this might become something of a problem.

Nevertheless I suggest you find the root cause of the problem to avoid any confusing or "strange" results.

Upvotes: 0

Related Questions