Search code examples
jsffile-uploadicefaces

JSF IllegalException: Component ID form: `xyz` has already been found in the view


I am getting IllegalStateException saying component ID form has already been found in the view and am not sure what is causing this issue and I do not want this exception in the first place.

Exception

Servlet.service() for servlet Faces Servlet threw exception: java.lang.IllegalStateException:
Component ID form:_captureFileOnsubmit has already been found in the view.
at com.sun.faces.util.Util.checkIdUniqueness(Util.java:846) [:2.1.7-SNAPSHOT]
at com.sun.faces.util.Util.checkIdUniqueness(Util.java:830) [:2.1.7-SNAPSHOT]
at com.sun.faces.util.Util.checkIdUniqueness(Util.java:830) [:2.1.7-SNAPSHOT]
at com.sun.faces.application.view.StateManagementStrategyImpl.saveView(StateManagementStrategyImpl.java:135) [:2.1.7-SNAPSHOT]
at com.sun.faces.application.StateManagerImpl.saveView(StateManagerImpl.java:133) [:2.1.7-SNAPSHOT]
at com.sun.faces.application.view.WriteBehindStateWriter.flushToWriter(WriteBehindStateWriter.java:225) [:2.1.7-SNAPSHOT]
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:419) [:2.1.7-SNAPSHOT]
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:125) [:2.1.7-SNAPSHOT]
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121) [:2.1.7-SNAPSHOT]
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [:2.1.7-SNAPSHOT]
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) [:2.1.7-SNAPSHOT]
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594) [:2.1.7-SNAPSHOT]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:324) [:6.0.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.0.0.Final]

My xhtml page looks like:

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:icecore="http://www.icefaces.org/icefaces/core"   xmlns:ace="http://www.icefaces.org/icefaces/components"    xmlns:ice="http://www.icesoft.com/icefaces/component">
    <script type="text/javascript" src="/js/icefaces/ace-jquery.js" />
    <script type="text/javascript" src="/js/icefaces/ace-components.js" />
    <script type="text/javascript" src="/js/icefaces/icepush.js" />
    <script type="text/javascript" src="/js/icefaces/bridge.js" />
    <script type="text/javascript" src="/js/icefaces/compat.js" />
    <script type="text/javascript" src="/js/icefaces/fileEntry.js" />
    <script type="text/javascript" src="/js/icefaces/jsf.js" />
    <script type="text/javascript" src="/js/icefaces/icefaces-compat.js" />

    <h:head>
        <title>ICEfaces 3</title>
        <link rel="stylesheet" type="text/css" href="/xmlhttp/css/rime/rime.css"/>
    </h:head>
    <h:body>
             <h:form id="form">
                <h:outputText value="Welcome to ICEfaces 3, select current date: "/>
                <ace:dateTimeEntry renderAsPopup="true">
                    <f:convertDateTime pattern="MM/dd/yyyy" timeZone="Canada/Mountain"/>
                </ace:dateTimeEntry>
                <ace:fileEntry id = "fileUpload"
                               label="File Entry"
                               relativePath="uploaded"
                               fileEntryListener="#{fileUpload.uploadFile}"/>
             <h:commandButton value="Upload File" />
             </h:form>
    </h:body>
</html>

All am trying to do is just get fileUpload feature working, wierd part is that javascript and css stuffs present in javax.faces.resources folder is not referenced in the application and so there are some of wierd errors that i get.

Another thing to note is if I use eclipse with icefaces plugins then fileUplaod feature works fine but if i try to build them without plugins and with only standard set of required jars then i am getting componenet id related IllegalStateException.

Any thoughts, suggestinos?

Updates

<context-param>
    <param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
    <param-value>true</param-value>
</context-param>

<context-param>
<param-name>javax.faces.VALIDATE_EMPTY_FIELDS</param-name>
<param-value>false</param-value>
</context-param>

<context-param>
<param-name>com.icesoft.faces.concurrentDOMViews</param-name>
<param-value>false</param-value>
</context-param>

<context-param>
<param-name>com.icesoft.faces.synchronousUpdate</param-name>
<param-value>false</param-value>
</context-param>

<context-param>
<param-name>com.icesoft.faces.blockingRequestHandler</param-name>
<param-value>icefaces</param-value>
</context-param>

<context-param>
<param-name>com.icesoft.faces.checkJavaScript</param-name>
<param-value>false</param-value>
</context-param>

Solution

  • I get errors like this using mojarra when I have javax.faces.PROJECT_STAGE set to Development. If you have this set change it to Production and see if the errors go away.

    I though it was known bug but can't find anything.