I'm getting duplicate ID errors randomly in my JSF pages, and in all of the instances, the duplicated ID is an auto-generated one (like j_id15).
I don't have any duplicates in the specified IDs in the page. And the issue is not consistent, I mean, a page view can throw duplicate ID error, and the next time I send a request for the same page it runs pretty well without any errors. And this is not specific to a single page, I have various pages in my project that has the same issue.
The issue started showing after upgrading from myfaces 2.0.5 to myfaces 2.0.14 (latest 2.0.x version)
Is this a bug in the myfaces implementation? Or am I doing something wrong?
The stack trace looks as follows:
Caused by: java.lang.IllegalStateException: Client-id : j_id15 is duplicated in the faces tree. Component : posSelectionFrm:posSelSubview_first:posHasAccessTable:j_id15, path: ...[Class: javax.faces.component.UINamingContainer,Id: posSelSubview_first][Class: javax.faces.component.html.HtmlDataTable,Id: posHasAccessTable][Class: javax.faces.component.UIColumn,Id: titleColumn2][Class: com.sun.facelets.compiler.UIInstructions,Id: j_id15]}
at org.apache.myfaces.application.StateManagerImpl.checkForDuplicateIds(StateManagerImpl.java:280)
at org.apache.myfaces.application.StateManagerImpl.checkForDuplicateIds(StateManagerImpl.java:302)
at org.apache.myfaces.application.StateManagerImpl.checkForDuplicateIds(StateManagerImpl.java:302)
at org.apache.myfaces.application.StateManagerImpl.checkForDuplicateIds(StateManagerImpl.java:302)
at org.apache.myfaces.application.StateManagerImpl.checkForDuplicateIds(StateManagerImpl.java:302)
at org.apache.myfaces.application.StateManagerImpl.checkForDuplicateIds(StateManagerImpl.java:302)
at org.apache.myfaces.application.StateManagerImpl.checkForDuplicateIds(StateManagerImpl.java:302)
at org.apache.myfaces.application.StateManagerImpl.checkForDuplicateIds(StateManagerImpl.java:302)
at org.apache.myfaces.application.StateManagerImpl.checkForDuplicateIds(StateManagerImpl.java:302)
at org.apache.myfaces.application.StateManagerImpl.checkForDuplicateIds(StateManagerImpl.java:302)
at org.apache.myfaces.application.StateManagerImpl.saveView(StateManagerImpl.java:220)
at javax.faces.application.StateManager.saveSerializedView(StateManager.java:113)
at javax.faces.application.StateManagerWrapper.saveSerializedView(StateManagerWrapper.java:41)
at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:617)
at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:100)
at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:176)
at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:116)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:239)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:191)
... 71 more
And, I realized the myfaces isn't supposed to check for duplicates for auto-generated IDs by default. But to make sure, I defined the following settings in web.xml:
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Production</param-value>
</context-param>
<context-param>
<param-name>org.apache.myfaces.CHECK_ID_PRODUCTION_MODE</param-name>
<param-value>false</param-value>
</context-param>
But the issue still persists.
The project uses Apache MyFaces 2.0.14, Facelets 1.1.15, RichFaces 3.3.3.Final running on Tomcat 6.0.