If a <f:ajax> tag is nested in a composite component that is placed in a <h:dataTable> with rowStatePreserved="true", an InstantiationException is thrown during RENDER_RESPONSE.
To reproduce
XHTML test case:
<h:dataTable
rowStatePreserved="true"
value="#{['1']}">
<h:column>
<my:compositecomponent>
<f:ajax/>
</my:compositecomponent>
</h:column>
</h:dataTable>
Stack Trace:
java.lang.IllegalStateException: java.lang.InstantiationException: com.sun.faces.facelets.tag.composite.RetargetedAjaxBehavior
at [email protected]//jakarta.faces.component.StateHolderSaver.restore(StateHolderSaver.java:129)
at [email protected]//jakarta.faces.component.UIComponentBase.restoreAttachedState(UIComponentBase.java:1425)
at [email protected]//jakarta.faces.component.UIComponentBase.restoreBehaviorsState(UIComponentBase.java:1752)
at [email protected]//jakarta.faces.component.UIComponentBase.restoreState(UIComponentBase.java:1224)
at [email protected]//jakarta.faces.component.UIData.restoreFullDescendantComponentStates(UIData.java:1468)
at [email protected]//jakarta.faces.component.UIData.restoreFullDescendantComponentStates(UIData.java:1477)
at [email protected]//jakarta.faces.component.UIData.restoreFullDescendantComponentStates(UIData.java:1477)
at [email protected]//jakarta.faces.component.UIData.restoreFullDescendantComponentStates(UIData.java:1477)
at [email protected]//jakarta.faces.component.UIData.restoreFullDescendantComponentStates(UIData.java:1477)
at [email protected]//jakarta.faces.component.UIData.setRowIndexRowStatePreserved(UIData.java:573)
at [email protected]//jakarta.faces.component.UIData.setRowIndex(UIData.java:475)
at [email protected]//com.sun.faces.renderkit.html_basic.TableRenderer.encodeChildren(TableRenderer.java:117)
at [email protected]//jakarta.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:556)
at [email protected]//com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:257)
at [email protected]//com.sun.faces.renderkit.html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:82)
at [email protected]//jakarta.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:556)
at [email protected]//com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:257)
at [email protected]//com.sun.faces.renderkit.html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:82)
at [email protected]//jakarta.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:556)
at [email protected]//jakarta.faces.component.UIComponent.encodeAll(UIComponent.java:1435)
at [email protected]//jakarta.faces.render.Renderer.encodeChildren(Renderer.java:146)
at [email protected]//jakarta.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:556)
at [email protected]//jakarta.faces.component.UIComponent.encodeAll(UIComponent.java:1435)
at [email protected]//jakarta.faces.component.UIComponent.encodeAll(UIComponent.java:1438)
at [email protected]//jakarta.faces.component.UIComponent.encodeAll(UIComponent.java:1438)
at [email protected]//com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:449)
at [email protected]//com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:160)
...
at [email protected]//jakarta.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:125)
at [email protected]//com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:93)
...
Caused by: java.lang.InstantiationException: com.sun.faces.facelets.tag.composite.RetargetedAjaxBehavior
at java.base/java.lang.Class.newInstance(Class.java:639)
at [email protected]//jakarta.faces.component.StateHolderSaver.restore(StateHolderSaver.java:127)
... 109 more
Caused by: java.lang.NoSuchMethodException: com.sun.faces.facelets.tag.composite.RetargetedAjaxBehavior.<init>()
at java.base/java.lang.Class.getConstructor0(Class.java:3585)
at java.base/java.lang.Class.newInstance(Class.java:626)
... 110 more
The StateHolderSaver effectively demands from classes that implement StateHolder that they provide a default constructor. The exception arises when it tries to instantiate the class RetargetedAjaxBehavior via a default constructor (that does not exist).
Context
Mojarra version: 4.0.7
Potentially caused by #5294
If a
<f:ajax>tag is nested in a composite component that is placed in a<h:dataTable>withrowStatePreserved="true", anInstantiationExceptionis thrown duringRENDER_RESPONSE.To reproduce
XHTML test case:
Stack Trace:
The
StateHolderSavereffectively demands from classes that implementStateHolderthat they provide a default constructor. The exception arises when it tries to instantiate the classRetargetedAjaxBehaviorvia a default constructor (that does not exist).Context
Mojarra version: 4.0.7
Potentially caused by #5294