close

There is a JSP on OC4J,
and there is a command <fmt:formatNumber value="${valueMap[yearQKey]}" groupingUsed="true" />.
It was used to grouping BigDecimal in a hash map.
It worked fine since 5 month ago, until we found a 100% reproducable exception recently.

Stack trace was under this article.
I used google to do some research,

and there is no confirmed solution found for "Response is already committed" exception.
2012/08/18 Updated : Oracle Forums article specified the reason and solution for this issue which is to increase page buffer size.

According to stack trace,
it seems that fmt do what it has to do and occur this exception when executing fmt.SetLocaleSupport.getFormattingLocale and fmt.SetLocaleSupport.setResponseLocale.

The first thought occurs to me is that the exception message seems time related.
The data is "0", "0", "0", "0", "0", "0", "12", "0", "0", "12",
and the exception happened after the fifth 0.

The previous data was over 10 thousands, and the exception was never happened.
The complicated data is fine, but the simple one is not.
It seems not so time related now.

Anyway, since there is no any reason, I have to use trial and error.
Reducing the usage of fmt or fastening fmt might work.

1.
Question: If the exception is caused by 0, do not use fmt when input is 0.
 <c:choose>
     <c:when test="${0 == value}">0
     </c:when>
     <c:otherwise>
         <fmt:formatNumber value="${valueMap[yearQKey]}" groupingUsed="true" />
     </c:otherwise>
 </c:choose>
Result: The exception is still happened after the fifth 0.
       It's totally nonsense, because 0 is just plaintext.
2.
Question: The "when" is correct or not?
 <c:choose>
     <c:when test="${0 == value}">0.0
     </c:when>
     <c:otherwise>
         <fmt:formatNumber value="${valueMap[yearQKey]}" groupingUsed="true" />
     </c:otherwise>
 </c:choose>
Result: The html output is "0.0", so the "when" is correct,
and the exception is gone! What happened?
The user is not accept "0.0" on the page, so I have to find another way.
3.
Question: What makes the "0.0" exception safe? Just try "A", "A.A", " 0", "0 ".
Result: These trials are all failed.
4.
Question: Maybe it's not caused by too slow, but too fast.
 <c:choose>
     <c:when test="${0 == value}">0<div></div>
     </c:when>
     <c:otherwise>
         <fmt:formatNumber value="${valueMap[yearQKey]}" groupingUsed="true" />
     </c:otherwise>
 </c:choose>
Result:The exception is not happening, amazing!
5.
Question: Append an empty div object there,
the programmer who take care of this system in the future might delete it,
and this will become an unexploded ordnance in system.
 <c:set var="value" value="${valueMap[yearQKey]}"/>
 <c:choose>
     <c:when test="${empty value or 0 == value}">0
     </c:when>
     <c:otherwise>
         <fmt:formatNumber value="${value}" groupingUsed="true" />
     </c:otherwise>
 </c:choose>
Result: The exception is not happening.
Though there is no any confirmed inference, and the test results are not rational at all.
Since the exception is solved, the solution 5 is acceptable.

Stacktrace:
java.lang.IllegalStateException: Response is already committed!
       at com.evermind[Oracle Application Server Containers for J2EE 10g
(10.1.2.0.0)].server.http.EvermindHttpServletResponse.setLocale(EvermindHttpServletResponse.java:1809)
       at org.apache.taglibs.standard.tag.common.fmt.SetLocaleSupport.setResponseLocale(SetLocaleSupport.java:200)
       at org.apache.taglibs.standard.tag.common.fmt.SetLocaleSupport.getFormattingLocale(SetLocaleSupport.java:282)
       at org.apache.taglibs.standard.tag.common.fmt.FormatNumberSupport.doEndTag(FormatNumberSupport.java:167)
       at _???._????._????._jspService(_????????.java:661)
       [SRC:/???/????/????????.jsp:99]
       at com.orionserver[Oracle Application Server Containers for J2EE 10g
(10.1.2.0.0)].http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
       at oracle.jsp.runtimev2.JspPageTable.compileAndServe(JspPageTable.java:567)
       at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:302)
       at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:509)
       at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:413)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
       at com.evermind[Oracle Application Server Containers for J2EE 10g
(10.1.2.0.0)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:810)
       at com.evermind[Oracle Application Server Containers for J2EE 10g
(10.1.2.0.0)].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:322)
       at com.evermind[Oracle Application Server Containers for J2EE 10g
(10.1.2.0.0)].server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:220)
       at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:111)
       at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250)
       at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:965)
       at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:744)
       at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:663)
       at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:394)
       at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:358)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
       at com.evermind[Oracle Application Server Containers for J2EE 10g
(10.1.2.0.0)].server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
       at com.vis.crm.filter.CrmUserProfileFilter.doFilter(CrmUserProfileFilter.java:70)
       at com.evermind[Oracle Application Server Containers for J2EE 10g
(10.1.2.0.0)].server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:16)
       at com.vis.crm.filter.CrmUserFilter.doFilter(CrmUserFilter.java:77)
       at com.evermind[Oracle Application Server Containers for J2EE 10g
(10.1.2.0.0)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:645)
       at com.evermind[Oracle Application Server Containers for J2EE 10g
(10.1.2.0.0)].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:322)
       at com.evermind[Oracle Application Server Containers for J2EE 10g
(10.1.2.0.0)].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
       at com.evermind[Oracle Application Server Containers for J2EE 10g
(10.1.2.0.0)].server.http.AJPRequestHandler.run(AJPRequestHandler.java:208)
       at com.evermind[Oracle Application Server Containers for J2EE 10g
(10.1.2.0.0)].server.http.AJPRequestHandler.run(AJPRequestHandler.java:125)
       at com.evermind[Oracle Application Server Containers for J2EE 10g
(10.1.2.0.0)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
       at java.lang.Thread.run(Thread.java:534)
arrow
arrow
    全站熱搜

    jsdb 發表在 痞客邦 留言(0) 人氣()