ICEfaces
  1. ICEfaces
  2. ICE-7952

The DataTable examples with component bindings throw duplicate id exception when running on MyFaces (was: The DataTable Row State example throws duplicate id exception when running as a portlet with MyFaces)

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.1, EE-3.0.0.GA, 3.1.0.BETA1
    • Fix Version/s: 3.2
    • Labels:
      None
    • Environment:
      ICEfaces 3 ACE Liferay portlet MyFaces
    • Assignee Priority:
      P1
    • Workaround Exists:
      Yes
    • Workaround Description:
      Hide
      Set the following context parameter to prevent MyFaces from checking for duplicates:


          <context-param>
              <param-name>org.apache.myfaces.CHECK_ID_PRODUCTION_MODE</param-name>
              <param-value>false</param-value>
          </context-param>
      Show
      Set the following context parameter to prevent MyFaces from checking for duplicates:     <context-param>         <param-name>org.apache.myfaces.CHECK_ID_PRODUCTION_MODE</param-name>         <param-value>false</param-value>     </context-param>

      Description

      When testing the DataTable Row State demo on Liferay 6 with MyFaces, I was able to get it to fail with a duplicate ID exception. Other Data Table examples also show this behaviour but I haven't test them all. It can be done in a couple of different ways:

        Activity

        Hide
        Deryk Sinotte added a comment -

        Screen snapshot show double table rendering and log of duplicate id exception.

        Show
        Deryk Sinotte added a comment - Screen snapshot show double table rendering and log of duplicate id exception.
        Hide
        Deryk Sinotte added a comment -

        Resolving as I can no longer reproduce this behaviour.

        Show
        Deryk Sinotte added a comment - Resolving as I can no longer reproduce this behaviour.
        Hide
        Deryk Sinotte added a comment -

        Need to re-open. The testing with Mojarra didn't show any issues but the testing with MyFaces still has an issue. Currently it logs:

        Caused by: java.lang.IllegalStateException: component with duplicate id "_jpfcpncuivr_A4116_j_id0:form:carTableRowExpansion:selectable" found
        at org.apache.myfaces.view.facelets.compiler.CheckDuplicateIdFaceletUtils.checkIdsStatefulComponents(CheckDuplicateIdFaceletUtils.java:54)
        at org.apache.myfaces.view.facelets.compiler.CheckDuplicateIdFaceletUtils.checkIdsStatefulComponents(CheckDuplicateIdFaceletUtils.java:75)
        at org.apache.myfaces.view.facelets.compiler.CheckDuplicateIdFaceletUtils.checkIdsStatefulComponents(CheckDuplicateIdFaceletUtils.java:75)
        at org.apache.myfaces.view.facelets.compiler.CheckDuplicateIdFaceletUtils.checkIdsStatefulComponents(CheckDuplicateIdFaceletUtils.java:75)
        at org.apache.myfaces.view.facelets.compiler.CheckDuplicateIdFaceletUtils.checkIdsStatefulComponents(CheckDuplicateIdFaceletUtils.java:75)
        at org.apache.myfaces.view.facelets.compiler.CheckDuplicateIdFaceletUtils.checkIdsStatefulComponents(CheckDuplicateIdFaceletUtils.java:75)
        at org.apache.myfaces.view.facelets.compiler.CheckDuplicateIdFaceletUtils.checkIdsStatefulComponents(CheckDuplicateIdFaceletUtils.java:75)
        at org.apache.myfaces.view.facelets.compiler.CheckDuplicateIdFaceletUtils.checkIdsStatefulComponents(CheckDuplicateIdFaceletUtils.java:35)
        at org.apache.myfaces.view.facelets.DefaultFaceletsStateManagementStrategy.saveView(DefaultFaceletsStateManagementStrategy.java:527)
        at org.apache.myfaces.application.StateManagerImpl.saveView(StateManagerImpl.java:189)
        at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.renderView(FaceletViewDeclarationLanguage.java:1979)
        at org.apache.myfaces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:285)
        at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:59)
        at com.liferay.faces.bridge.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:91)
        at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:116)
        at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:241)

        Show
        Deryk Sinotte added a comment - Need to re-open. The testing with Mojarra didn't show any issues but the testing with MyFaces still has an issue. Currently it logs: Caused by: java.lang.IllegalStateException: component with duplicate id "_jpfcpncuivr_A4116_j_id0:form:carTableRowExpansion:selectable" found at org.apache.myfaces.view.facelets.compiler.CheckDuplicateIdFaceletUtils.checkIdsStatefulComponents(CheckDuplicateIdFaceletUtils.java:54) at org.apache.myfaces.view.facelets.compiler.CheckDuplicateIdFaceletUtils.checkIdsStatefulComponents(CheckDuplicateIdFaceletUtils.java:75) at org.apache.myfaces.view.facelets.compiler.CheckDuplicateIdFaceletUtils.checkIdsStatefulComponents(CheckDuplicateIdFaceletUtils.java:75) at org.apache.myfaces.view.facelets.compiler.CheckDuplicateIdFaceletUtils.checkIdsStatefulComponents(CheckDuplicateIdFaceletUtils.java:75) at org.apache.myfaces.view.facelets.compiler.CheckDuplicateIdFaceletUtils.checkIdsStatefulComponents(CheckDuplicateIdFaceletUtils.java:75) at org.apache.myfaces.view.facelets.compiler.CheckDuplicateIdFaceletUtils.checkIdsStatefulComponents(CheckDuplicateIdFaceletUtils.java:75) at org.apache.myfaces.view.facelets.compiler.CheckDuplicateIdFaceletUtils.checkIdsStatefulComponents(CheckDuplicateIdFaceletUtils.java:75) at org.apache.myfaces.view.facelets.compiler.CheckDuplicateIdFaceletUtils.checkIdsStatefulComponents(CheckDuplicateIdFaceletUtils.java:35) at org.apache.myfaces.view.facelets.DefaultFaceletsStateManagementStrategy.saveView(DefaultFaceletsStateManagementStrategy.java:527) at org.apache.myfaces.application.StateManagerImpl.saveView(StateManagerImpl.java:189) at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.renderView(FaceletViewDeclarationLanguage.java:1979) at org.apache.myfaces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:285) at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:59) at com.liferay.faces.bridge.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:91) at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:116) at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:241)
        Hide
        Deryk Sinotte added a comment -

        To duplicate, it appears that you only need to reload the page with a datatable portlet example to replicate this issue.

        Show
        Deryk Sinotte added a comment - To duplicate, it appears that you only need to reload the page with a datatable portlet example to replicate this issue.
        Hide
        Deryk Sinotte added a comment -

        Document setting context parameter as a workaround.

        Show
        Deryk Sinotte added a comment - Document setting context parameter as a workaround.
        Hide
        Deryk Sinotte added a comment -

        Revising the Summary and Description to more accurately reflect the problem.

        Show
        Deryk Sinotte added a comment - Revising the Summary and Description to more accurately reflect the problem.
        Hide
        Deryk Sinotte added a comment - - edited

        Retested and the problem is still there. However, I tried a few of the other datatable examples and the only one that I could get to fail so far is the Row State example. So it might be confined more specifically to that example or that component.

        Show
        Deryk Sinotte added a comment - - edited Retested and the problem is still there. However, I tried a few of the other datatable examples and the only one that I could get to fail so far is the Row State example. So it might be confined more specifically to that example or that component.
        Hide
        Deryk Sinotte added a comment - - edited

        <context-param>
        <param-name>org.apache.myfaces.CHECK_ID_PRODUCTION_MODE</param-name>
        <param-value>false</param-value>
        </context-param>

        You can also not use a component binding or only bind to request-scoped beans.

        was:
        Set the following context parameter to prevent MyFaces from checking for duplicates:

        <context-param>
        <param-name>org.apache.myfaces.CHECK_ID_PRODUCTION_MODE</param-name>
        <param-value>false</param-value>
        </context-param>

        Description:
        When testing the DataTable Row State demo on Liferay 6 with MyFaces, I was able to get it to fail with a duplicate ID exception. Other Data Table examples also show this behaviour but I haven't test them all. It can be done in a couple of different ways:

        1) Reload a page with the Data Table Row State example

        or

        1) Setup two different portal pages with a least one of them container a Data Table Row State.
        2) Visit Page A - the portal page with the Row State portlet. Iinteraction with the portlet doesn't appear necessary from what I've seen so far.
        3) Visit Page B
        4) Go back to Page A.

        You can also replicate this in a non-portlet environment. If you switch out the main DataTable example with one of the ones that uses a component binding (Find, Grouping, or Row State), load the example and then reload the page, the same problem occurs.

        MyFaces: Ends up throwing a duplicate id exception

        was:
        When testing the DataTable Row State demo on Liferay 6 with MyFaces, I was able to get it to fail with a duplicate ID exception. Other Data Table examples also show this behaviour but I haven't test them all. It can be done in a couple of different ways:

        1) Reload a page with the Data Table Row State example

        or

        1) Setup two different portal pages with a least one of them container a Data Table Row State.
        2) Visit Page A - the portal page with the Row State portlet. Iinteraction with the portlet doesn't appear necessary from what I've seen so far.
        3) Visit Page B
        4) Go back to Page A.

        MyFaces: Ends up throwing a duplicate id exception

        Environment: ICEfaces 3 ACE MyFaces Datatable bindings (was: ICEfaces 3 ACE Liferay portlet MyFaces)

        Adjusting the Summary, Description, and Workaround to reflect the following findings.

        This is not particular to portlets. The regular showcase will show the same problem provided some adjustments are made. You need to make one of the examples that use

        It turns out the only problematic examples are the DataTable examples that utilize component bindings (binding=). These are dataTableFind, dataTableGrouping, and dataTableRowState. The problem doesn't manifest if these are done via sub-examples because a page reload takes you back to the main example which avoids the issue. If you make one of the problematic examples the main datatable example (simply copy the h:form contents into datatable.xhtml), redeploy, load and then reload, the duplicate Id problem manifests.

        By removing the binding (or changing the scope of the bean that holds the reference to the bound component to RequestScoped), the problem goes away. So at this point, it is more of an app issue related to MyFaces.

        Show
        Deryk Sinotte added a comment - - edited <context-param> <param-name>org.apache.myfaces.CHECK_ID_PRODUCTION_MODE</param-name> <param-value>false</param-value> </context-param> You can also not use a component binding or only bind to request-scoped beans. was: Set the following context parameter to prevent MyFaces from checking for duplicates: <context-param> <param-name>org.apache.myfaces.CHECK_ID_PRODUCTION_MODE</param-name> <param-value>false</param-value> </context-param> Description: When testing the DataTable Row State demo on Liferay 6 with MyFaces, I was able to get it to fail with a duplicate ID exception. Other Data Table examples also show this behaviour but I haven't test them all. It can be done in a couple of different ways: 1) Reload a page with the Data Table Row State example or 1) Setup two different portal pages with a least one of them container a Data Table Row State. 2) Visit Page A - the portal page with the Row State portlet. Iinteraction with the portlet doesn't appear necessary from what I've seen so far. 3) Visit Page B 4) Go back to Page A. You can also replicate this in a non-portlet environment. If you switch out the main DataTable example with one of the ones that uses a component binding (Find, Grouping, or Row State), load the example and then reload the page, the same problem occurs. MyFaces: Ends up throwing a duplicate id exception was: When testing the DataTable Row State demo on Liferay 6 with MyFaces, I was able to get it to fail with a duplicate ID exception. Other Data Table examples also show this behaviour but I haven't test them all. It can be done in a couple of different ways: 1) Reload a page with the Data Table Row State example or 1) Setup two different portal pages with a least one of them container a Data Table Row State. 2) Visit Page A - the portal page with the Row State portlet. Iinteraction with the portlet doesn't appear necessary from what I've seen so far. 3) Visit Page B 4) Go back to Page A. MyFaces: Ends up throwing a duplicate id exception Environment: ICEfaces 3 ACE MyFaces Datatable bindings (was: ICEfaces 3 ACE Liferay portlet MyFaces) Adjusting the Summary, Description, and Workaround to reflect the following findings. This is not particular to portlets. The regular showcase will show the same problem provided some adjustments are made. You need to make one of the examples that use It turns out the only problematic examples are the DataTable examples that utilize component bindings (binding=). These are dataTableFind, dataTableGrouping, and dataTableRowState. The problem doesn't manifest if these are done via sub-examples because a page reload takes you back to the main example which avoids the issue. If you make one of the problematic examples the main datatable example (simply copy the h:form contents into datatable.xhtml), redeploy, load and then reload, the duplicate Id problem manifests. By removing the binding (or changing the scope of the bean that holds the reference to the bound component to RequestScoped), the problem goes away. So at this point, it is more of an app issue related to MyFaces.
        Hide
        Deryk Sinotte added a comment - - edited

        Assigning to Ken for re-assignment as desired. If we want the affected examples to work with MyFaces we'll need to re-work how we use the component bindings.
        I found a decent description of the dangers of doing this type of binding and why it leads to duplicate id issues here:
        http://myfaces.apache.org/orchestra/myfaces-orchestra-core/component-bindings.html
        It provides a summary of using a "request-scoped facade" if we want to tweak the application but still use bindings.

        Show
        Deryk Sinotte added a comment - - edited Assigning to Ken for re-assignment as desired. If we want the affected examples to work with MyFaces we'll need to re-work how we use the component bindings. I found a decent description of the dangers of doing this type of binding and why it leads to duplicate id issues here: http://myfaces.apache.org/orchestra/myfaces-orchestra-core/component-bindings.html It provides a summary of using a "request-scoped facade" if we want to tweak the application but still use bindings.
        Hide
        Ken Fyten added a comment - - edited

        Assigned to Nils to revise the ace:dataTable Window-scope bean bindings in showcase.

        Show
        Ken Fyten added a comment - - edited Assigned to Nils to revise the ace:dataTable Window-scope bean bindings in showcase.
        Hide
        Nils Lundquist added a comment - - edited

        I'll just revise these cases to find the component instance using VisitTree.

        Show
        Nils Lundquist added a comment - - edited I'll just revise these cases to find the component instance using VisitTree.
        Hide
        Nils Lundquist added a comment - - edited

        Revision #31485
        Committed by nils.lundquist
        Moments ago
        ICE-7952 - Fix MyFaces compatibility. ace:dataTable showcase example now access component binding via RequestScoped bean.
        It was also required that each example also had a unique request scoped component binding. The titular error was caused when navigating between examples and a RequestScoped binding was shared. I suppose this is because the same reference is used at state load and rendering, despite actually being different components.

        Show
        Nils Lundquist added a comment - - edited Revision #31485 Committed by nils.lundquist Moments ago ICE-7952 - Fix MyFaces compatibility. ace:dataTable showcase example now access component binding via RequestScoped bean. It was also required that each example also had a unique request scoped component binding. The titular error was caused when navigating between examples and a RequestScoped binding was shared. I suppose this is because the same reference is used at state load and rendering, despite actually being different components.
        Hide
        Carmen Cristurean added a comment - - edited

        Reopening (as requested by Ken), due to this showcase - dataTable regression (trunk rev# 31487/ 31497):
        DataTable - Find: search not functional, and NullPointerException in tomcat log when searching (using any search type or search query string):
        SEVERE: JSF1073: javax.faces.event.AbortProcessingException caught during processing of INVOKE_APPLICATION 5 : UIComponent-ClientId=form:findNext, Message=/resources/examples/ace/dataTable/dataTableFind.xhtml @63,147 actionListener="#

        {aceDataTableFind.find}": java.lang.NullPointerException
        16-Oct-2012 8:47:15 AM com.sun.faces.context.AjaxExceptionHandlerImpl log
        SEVERE: /resources/examples/ace/dataTable/dataTableFind.xhtml @63,147 actionListener="#{aceDataTableFind.find}

        ": java.lang.NullPointerException
        javax.faces.event.AbortProcessingException: /resources/examples/ace/dataTable/dataTableFind.xhtml @63,147 actionListener="#

        {aceDataTableFind.find}

        ": java.lang.NullPointerException
        at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:182)
        at javax.faces.event.ActionEvent.processListener(ActionEvent.java:88)
        at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:769)
        ......
        Caused by: java.lang.NullPointerException
        at org.icefaces.samples.showcase.example.ace.dataTable.DataTableFind.find(DataTableFind.java:116)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.el.parser.AstValue.invoke(AstValue.java:264)
        at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:278)
        at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
        at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:148)
        ... 25 more

        Show
        Carmen Cristurean added a comment - - edited Reopening (as requested by Ken), due to this showcase - dataTable regression (trunk rev# 31487/ 31497): DataTable - Find: search not functional, and NullPointerException in tomcat log when searching (using any search type or search query string): SEVERE: JSF1073: javax.faces.event.AbortProcessingException caught during processing of INVOKE_APPLICATION 5 : UIComponent-ClientId=form:findNext, Message=/resources/examples/ace/dataTable/dataTableFind.xhtml @63,147 actionListener="# {aceDataTableFind.find}": java.lang.NullPointerException 16-Oct-2012 8:47:15 AM com.sun.faces.context.AjaxExceptionHandlerImpl log SEVERE: /resources/examples/ace/dataTable/dataTableFind.xhtml @63,147 actionListener="#{aceDataTableFind.find} ": java.lang.NullPointerException javax.faces.event.AbortProcessingException: /resources/examples/ace/dataTable/dataTableFind.xhtml @63,147 actionListener="# {aceDataTableFind.find} ": java.lang.NullPointerException at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:182) at javax.faces.event.ActionEvent.processListener(ActionEvent.java:88) at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:769) ...... Caused by: java.lang.NullPointerException at org.icefaces.samples.showcase.example.ace.dataTable.DataTableFind.find(DataTableFind.java:116) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.el.parser.AstValue.invoke(AstValue.java:264) at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:278) at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105) at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:148) ... 25 more
        Hide
        Carmen Cristurean added a comment - - edited

        Re-tested showcase - dataTable - Find / verified fix with trunk rev. 31504 in Firefox14.

        Show
        Carmen Cristurean added a comment - - edited Re-tested showcase - dataTable - Find / verified fix with trunk rev. 31504 in Firefox14.
        Hide
        Nils Lundquist added a comment -

        Adding resolution missed by migration.

        Show
        Nils Lundquist added a comment - Adding resolution missed by migration.

          People

          • Assignee:
            Nils Lundquist
            Reporter:
            Deryk Sinotte
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: