Using the jstl/fmt tag can cause "java.lang.IllegalStateException: Response is already committed!" on Oracle(9|10)iAS. I believe that the stack trace provided (see below) indicates that this is due to a fmt:formatDate which is attempting to setLocale after the response buffer has already been written. This probably only occurs when the buffer size reaches it's limit before this code is encountered. It looks like FormatDateSuport.java calls SetLocaleSupport.java:getFormattingLocale which then calls setResponseLocale. My question / concern is whether there is a way to keep it from attempting to set the locale since this cannot be done once the response has begun. Is there a reason that it must do this and if so is there a workaround? at com.evermind.server.http.EvermindHttpServletResponse.setLocale(EvermindHttpServletResponse.java:1808) at org.apache.taglibs.standard.tag.common.fmt.SetLocaleSupport.setResponseLocale(SetLocaleSupport.java:234) at org.apache.taglibs.standard.tag.common.fmt.SetLocaleSupport.getFormattingLocale(SetLocaleSupport.java:314) at org.apache.taglibs.standard.tag.common.fmt.FormatDateSupport.doEndTag(FormatDateSupport.java:148) at _jsp_page._jspService(_jsp_page.java:4518)
A colleague of mine just run into this same problem - same tag, same stack trace, but different line in the fmt tag implementation, probably because of a different version: java.lang.IllegalStateException: Response is already committed! at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.EvermindHttpServletResponse.setLocale(EvermindH ttpServletResponse.java:1808) at org.apache.taglibs.standard.tag.common.fmt.SetLocaleSupport.setResponseL ocale(SetLocaleSupport.java:200) ... ... Is this fixed in one of the newer version? Does anyone know if this is a known Oracle app server/servlet engine bug?
I would say that after the source examination, the MessageSupport calls( for no apparent reason) SetLocaleSupport.setLocale. That is what causing the exception due to the server's behaviour i.e. commiting response when it wants (and I'm not pointing fingers here). Two things could be done: 1. Do not call the SetLocaleSupport as it is not the right place to set Locale on the response. And/Or 2. Check if the response has been committed b4 setting locale (in SetLocaleSupport)
I'm having the same problem, but am not explicitly making any calls to set the locale. Here's the code that caused the exception... <fmt:formatDate value="${myBean.myDate}" /> And the exception... java.lang.IllegalStateException: Response is already committed! at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.EvermindHttpServletResponse.setLocale(EvermindHttpServletResponse.java:1808) at org.apache.taglibs.standard.tag.common.fmt.SetLocaleSupport.setResponseLocale(SetLocaleSupport.java:234) at org.apache.taglibs.standard.tag.common.fmt.SetLocaleSupport.getFormattingLocale(SetLocaleSupport.java:314) at org.apache.taglibs.standard.tag.common.fmt.FormatDateSupport.doEndTag(FormatDateSupport.java:148) at _MyJsp._jspService(_MyJsp.java:870)
Looking around, this looks like an interesting issue that has been resolved as INVALID: http://issues.apache.org/bugzilla/show_bug.cgi?id=19408 It looks like the same problem, but in this case for Tomcat 4. The comment from Pierre appears to imply it's a problem with the container, and I'm guessing the same would apply to the container in Oracle. This seems like a WONTFIX.
Looks like the bug is in the container, marking WONTFIX.