When our servers were updated from JSF Mojarra 2.1.19 to 2.1.28, we started noticing crashes in many pages of our web application. We had to rollback the update and stay with 2.1.19.
A real example of the case is a webpage where we have dynamic collapsibles, each of which contains dynamic tabsets, each of which contains dynamic fields of different kinds with search boxes, calendars, ajax events, all of this managed by a data dictionary which defines form groups, forms, and fields. We use a lot of c:forEach, c:if, composite components, and facelets includes.
Thankfully, after some efforts, I managed to narrow down the case make it as simple as I could.
If you create a small web application with the code bellow, and run it, you click on the "Tab 1" link, the application switches to tab 1, then you click on "Tab 0" to return to tab 0, then there is an exception.
Please note that if I remove the f:ajax onchange events on both String FIelds, it works without crashing. Also, if I replace the String field composite components with normal h:InputText components, it also works without crashing (with the f:ajax events).
Here is a list of the Mojarra versions on which I tested the case :
2.1.19 = ok
2.1.21 = ok
2.1.22 = crash
2.1.23 = crash
2.1.24 = crash
2.1.25 = crash
2.1.26 = crash
2.1.27 = crash
2.1.28 = crash
2.1.29 = crash
Here is the stack trace :
SEVERE [javax.enterprise.resource.webcontainer.jsf.context] java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
at java.util.ArrayList.rangeCheck(Unknown Source)
at java.util.ArrayList.get(Unknown Source)
at javax.faces.component.UIComponentBase.restoreBehaviors(UIComponentBase.java:2177)
at javax.faces.component.UIComponentBase.restoreBehaviorsState(UIComponentBase.java:2153)
at javax.faces.component.UIComponentBase.restoreState(UIComponentBase.java:1573)
at javax.faces.component.UIOutput.restoreState(UIOutput.java:272)
at javax.faces.component.UIInput.restoreState(UIInput.java:1411)
at com.sun.faces.application.view.FaceletPartialStateManagementStrategy$2.visit(FaceletPartialStateManagementStrategy.java:380)
at com.sun.faces.component.visit.FullVisitContext.invokeVisitCallback(FullVisitContext.java:151)
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1652)
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1663)
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1663)
at javax.faces.component.UINamingContainer.visitTree(UINamingContainer.java:174)
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1663)
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1663)
at javax.faces.component.UIForm.visitTree(UIForm.java:371)
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1663)
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1663)
at com.sun.faces.application.view.FaceletPartialStateManagementStrategy.restoreView(FaceletPartialStateManagementStrategy.java:367)
at com.sun.faces.application.StateManagerImpl.restoreView(StateManagerImpl.java:138)
at com.sun.faces.application.view.ViewHandlingStrategy.restoreView(ViewHandlingStrategy.java:123)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.restoreView(FaceletViewHandlingStrategy.java:577)
at com.sun.faces.application.view.MultiViewHandler.restoreView(MultiViewHandler.java:142)
at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:192)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.__invoke(StandardContextValve.java:149)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java)
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:336)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:920)
at java.lang.Thread.run(Unknown Source)
When our servers were updated from JSF Mojarra 2.1.19 to 2.1.28, we started noticing crashes in many pages of our web application. We had to rollback the update and stay with 2.1.19.
A real example of the case is a webpage where we have dynamic collapsibles, each of which contains dynamic tabsets, each of which contains dynamic fields of different kinds with search boxes, calendars, ajax events, all of this managed by a data dictionary which defines form groups, forms, and fields. We use a lot of c:forEach, c:if, composite components, and facelets includes.
Thankfully, after some efforts, I managed to narrow down the case make it as simple as I could.
If you create a small web application with the code bellow, and run it, you click on the "Tab 1" link, the application switches to tab 1, then you click on "Tab 0" to return to tab 0, then there is an exception.
Please note that if I remove the f:ajax onchange events on both String FIelds, it works without crashing. Also, if I replace the String field composite components with normal h:InputText components, it also works without crashing (with the f:ajax events).
Here is a list of the Mojarra versions on which I tested the case : 2.1.19 = ok 2.1.21 = ok 2.1.22 = crash 2.1.23 = crash 2.1.24 = crash 2.1.25 = crash 2.1.26 = crash 2.1.27 = crash 2.1.28 = crash 2.1.29 = crash
Here is the stack trace : SEVERE [javax.enterprise.resource.webcontainer.jsf.context] java.lang.IndexOutOfBoundsException: Index: 1, Size: 1 at java.util.ArrayList.rangeCheck(Unknown Source) at java.util.ArrayList.get(Unknown Source) at javax.faces.component.UIComponentBase.restoreBehaviors(UIComponentBase.java:2177) at javax.faces.component.UIComponentBase.restoreBehaviorsState(UIComponentBase.java:2153) at javax.faces.component.UIComponentBase.restoreState(UIComponentBase.java:1573) at javax.faces.component.UIOutput.restoreState(UIOutput.java:272) at javax.faces.component.UIInput.restoreState(UIInput.java:1411) at com.sun.faces.application.view.FaceletPartialStateManagementStrategy$2.visit(FaceletPartialStateManagementStrategy.java:380) at com.sun.faces.component.visit.FullVisitContext.invokeVisitCallback(FullVisitContext.java:151) at javax.faces.component.UIComponent.visitTree(UIComponent.java:1652) at javax.faces.component.UIComponent.visitTree(UIComponent.java:1663) at javax.faces.component.UIComponent.visitTree(UIComponent.java:1663) at javax.faces.component.UINamingContainer.visitTree(UINamingContainer.java:174) at javax.faces.component.UIComponent.visitTree(UIComponent.java:1663) at javax.faces.component.UIComponent.visitTree(UIComponent.java:1663) at javax.faces.component.UIForm.visitTree(UIForm.java:371) at javax.faces.component.UIComponent.visitTree(UIComponent.java:1663) at javax.faces.component.UIComponent.visitTree(UIComponent.java:1663) at com.sun.faces.application.view.FaceletPartialStateManagementStrategy.restoreView(FaceletPartialStateManagementStrategy.java:367) at com.sun.faces.application.StateManagerImpl.restoreView(StateManagerImpl.java:138) at com.sun.faces.application.view.ViewHandlingStrategy.restoreView(ViewHandlingStrategy.java:123) at com.sun.faces.application.view.FaceletViewHandlingStrategy.restoreView(FaceletViewHandlingStrategy.java:577) at com.sun.faces.application.view.MultiViewHandler.restoreView(MultiViewHandler.java:142) at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:192) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116) at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) at org.apache.catalina.core.StandardContextValve.__invoke(StandardContextValve.java:149) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java) at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:336) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:920) at java.lang.Thread.run(Unknown Source)
The view (Test.xhtml):
<?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:fields="http://java.sun.com/jsf/composite/fields">