JSF: javax.faces.FacesException: Cannot add the sa

2019-05-27 07:43发布

问题:

I am a JSF beginner. I try to implement ICEfaces 3.0 component in Eclipse 4.2 (Juno). I had implemented & run it using Apache Tomcat 7.0. It showing the following error in window:

Cannot add the same component twice

In console bar it shows as :

javax.faces.FacesException: Cannot add the same component twice: v8z4ho2-retrieve-update

My JSF Code

<?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" >

<h:head>
    <title>Chart</title>
    <link rel="stylesheet" type="text/css" href="./xmlhttp/css/rime/rime.css"/>
</h:head>

<h:body styleClass="ice-skin-rime">     
    <h:form id="canvasForm">
        <ace:chart id="chart" animated="false" value="#{chartBean.barData}"
            stackSeries="false" defaultAxesConfig="#{chartBean.barDemoDefaultAxis}"
            xAxis="#{chartBean.barDemoXAxis}" yAxis="#{chartBean.barDemoYAxis}"
            legend="true"  legendPlacement="OUTSIDE_GRID" highlighter="true"
            highlighterLocation="N" highlighterShowMarker="false"       
            highlighterBringSeriesToFront="true"
            widgetVar="barChart" />
    </h:form>    
</h:body>
</html>

How to rectify this error? Help me out.

回答1:

In ICEFaces forum I've found many people with this problem. If you are using Tomcat 7.0.42, try Tomcat 7.0.41 instead and see if it works. Also check if you have icefaces jar duplicated (or icefaces.jar and icefaces-ee.jar) in the same classpath. The link to the post is:

http://www.icesoft.org/JForum/posts/list/22121.page#sthash.qxEkXX1Q.dpbs



回答2:

Fixed by reverting icefaces version from 3.3.0 to 3.0.1:

    <!-- Ices Dependencies -->
    <dependency>
        <groupId>org.icefaces</groupId>
        <artifactId>icefaces</artifactId>
        <version>3.0.1</version>
    </dependency>

    <dependency>
        <groupId>org.icefaces</groupId>
        <artifactId>icefaces-ace</artifactId>
        <version>3.0.1</version>
    </dependency>

    <dependency>
        <groupId>org.icefaces</groupId>
        <artifactId>icefaces-compat</artifactId>
        <version>3.0.1</version>
    </dependency>

    <dependency>
        <groupId>org.icepush</groupId>
        <artifactId>icepush</artifactId>
        <version>3.1.0</version>
    </dependency>