1

My setup is java 1.6.0_45, richfaces 4.3.2, jsf 2.1.5, tomcat 7.0.30, in IntelliJ IDEA 11.

I'm facing the following exception:

  java.lang.IllegalArgumentException: duplicate key: class javax.faces.convert.DoubleConverter
        at com.google.common.base.Preconditions.checkArgument(Preconditions.java:115)
        at com.google.common.collect.RegularImmutableMap.<init>(RegularImmutableMap.java:72)
        at com.google.common.collect.ImmutableMap$Builder.fromEntryList(ImmutableMap.java:221)
        at com.google.common.collect.ImmutableMap$Builder.build(ImmutableMap.java:207)
        at org.richfaces.javascript.ClientServiceConfigParser.parseConfig(ClientServiceConfigParser.java:54)
    ...

I have searched here and the closest issues I have found are:

- Here and here

Both posts essentially address the same issue. The csv.xml file is being referenced in more than one JAR in the /WEB-INF/lib folder of the project. I wrote a little script to 'jar tf' each of the files in my lib directory piping the output to a grep for csv.xml and it shows just the one entry.

Here's a screenshot of my /WEB-INF/lib folder:

Why do I still get this exception and how can I solve it?

My class path being used is as follows:

-classpath "/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/deploy.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/dt.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/javaws.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/jce.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/jconsole.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/management-agent.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/plugin.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/sa-jdi.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/alt-rt.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/alt-string.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/charsets.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/jsse.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/ui.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/apple_provider.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/dnsns.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/localedata.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/sunjce_provider.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/sunpkcs11.jar:/data/devl/projects/cannon/register/web/WEB-INF/classes:/data/devl/apache-tomcat-7.0.30/bin/tomcat-juli.jar:/data/devl/apache-tomcat-7.0.30/bin/bootstrap.jar:/data/devl/apache-tomcat-7.0.30/bin/commons-daemon.jar:/data/devl/apache-tomcat-7.0.30/lib/tomcat-coyote.jar:/data/devl/apache-tomcat-7.0.30/lib/annotations-api.jar:/data/devl/apache-tomcat-7.0.30/lib/el-api.jar:/data/devl/apache-tomcat-7.0.30/lib/jasper-el.jar:/data/devl/apache-tomcat-7.0.30/lib/ecj-3.7.2.jar:/data/devl/apache-tomcat-7.0.30/lib/jasper.jar:/data/devl/apache-tomcat-7.0.30/lib/servlet-api.jar:/data/devl/apache-tomcat-7.0.30/lib/catalina-ha.jar:/data/devl/apache-tomcat-7.0.30/lib/tomcat-api.jar:/data/devl/apache-tomcat-7.0.30/lib/tomcat-dbcp.jar:/data/devl/apache-tomcat-7.0.30/lib/jsp-api.jar:/data/devl/apache-tomcat-7.0.30/lib/tomcat-util.jar:/data/devl/apache-tomcat-7.0.30/lib/catalina.jar:/data/devl/apache-tomcat-7.0.30/lib/tomcat-jdbc.jar:/data/devl/apache-tomcat-7.0.30/lib/catalina-tribes.jar:/data/devl/apache-tomcat-7.0.30/lib/catalina-ant.jar:/data/devl/apache-tomcat-7.0.30/lib/tomcat-i18n-es.jar:/data/devl/apache-tomcat-7.0.30/lib/tomcat-i18n-fr.jar:/data/devl/apache-tomcat-7.0.30/lib/tomcat-i18n-ja.jar:/data/devl/projects/cannon/register/web/WEB-INF/lib/commons-beanutils-1.8.3.jar:/data/devl/projects/cannon/register/web/WEB-INF/lib/commons-codec-1.3.jar:/data/devl/projects/cannon/register/web/WEB-INF/lib/commons-collections-3.2.jar:/data/devl/projects/cannon/register/web/WEB-INF/lib/commons-digester-1.8.jar:/data/devl/projects/cannon/register/web/WEB-INF/lib/commons-logging-1.1.1.jar:/data/devl/projects/cannon/register/web/WEB-INF/lib/cssparser-0.9.5.jar:/data/devl/projects/cannon/register/web/WEB-INF/lib/guava-14.0.1.jar:/data/devl/projects/cannon/register/web/WEB-INF/lib/javax.faces-2.1.5.jar:/data/devl/projects/cannon/register/web/WEB-INF/lib/jhighlight-1.0.jar:/data/devl/projects/cannon/register/web/WEB-INF/lib/sac-1.3.jar:/data/devl/projects/cannon/register/web/WEB-INF/lib/richfaces-core-api-4.3.2.Final.jar:/data/devl/projects/cannon/register/web/WEB-INF/lib/richfaces-core-impl-4.3.2.Final.jar:/data/devl/projects/cannon/register/web/WEB-INF/lib/richfaces-components-api-4.3.2.Final.jar:/data/devl/projects/cannon/register/web/WEB-INF/lib/richfaces-components-ui-4.3.2.Final.jar:/Applications/IntelliJ IDEA 11.app/lib/idea_rt.jar" com.intellij.rt.execution.application.AppMain org.apache.catalina.startup.Bootstrap start

Just for kicks, I ran my same script to search for 'csv.xml' in all of the included tomcat paths as well, but there were no occurrences. I figured it would be a bit overkill to also run it in the java home location.

I also exported the project to a war and I still have the same issue. I exploded the war file and looked in the /WEB-INF/lib directory to find the following:

This should indicate EXACTLY which jars are being used. And from what I can tell, none of these jar files should have any conflict with the rich faces libraries. I ran my csv.xml search script against this directory and again it came up with exactly one entry.

Community
  • 1
  • 1
Lance
  • 39
  • 6

2 Answers2

1

The webapp's runtime classpath covers more than only /WEB-INF/lib. It also covers among others server's own /lib folder and, if any, the "common" and "shared" libraries which are server-specific and configurable in server end. It also covers the JRE's /lib and /lib/ext folder.

Usually, those folders are not to be touched by developers, for sure not by starters. Apparently you've somehow a copy of RichFaces JAR in one of those places. At least, the fact that you keep getting this exception while having a proper /WEB-INF/lib confirms this. To figure the exact local disk file system paths covered by the runtime classpath, run just for debug this piece of code in your webapp, e.g. in constructor of a test backing bean:

System.out.println("The current runtime classpath covers the following paths:");
for (URL url : Collections.list(Thread.currentThread().getContextClassLoader().getResources(""))) {
   System.out.println(url);
}

Another probable cause would be that you're not running the code you think you're running. Choose Export > WAR in your IDE and then extract the WAR and explore the libs. Or look in the deploy folder of the runtime server and check the /WEB-INF/lib folder actually being used during runtime. Perhaps you've configured the project somehow to include additional JARs from elsewhere on the local disk file system during the build. I don't do IntelliJ, but in Eclipse you can control it in Deployment Assembly property of the project. Perhaps you've ever fiddled around in such a setting in a headless attempt to fix compilation/runtime problems with JSF and/or RichFaces libraries and forgot to revert/undo those settings once you figured that just dropping the JARs in /WEB-INF/lib would be the right way.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • I added the classpath info to my submission. It must be limited to that, but I will try exporting to war and see what happens also. – Lance Jun 12 '13 at 14:28
  • Lance, this information is useless to me. It's only useful to you so that you can check if there are RichFaces JARs over there. I can't as I don't have direct access to your environment. – BalusC Jun 12 '13 at 14:33
  • I followed your suggestion of deploying as a war file and I still see the problem. See details in the recent edits to original post. – Lance Jun 12 '13 at 15:16
  • Those Tomcat libraries absolutely don't belong in `/WEB-INF/lib`. – BalusC Jun 12 '13 at 15:20
  • Screw it. I dropped icefaces in place and it worked like a charm. Sorry, RichFaces! – Lance Jun 12 '13 at 17:12
-1

Just go with IceFaces. It's just as powerful and much easier than dealing with this crap! I dropped the jars in place and away I went.

Lance
  • 39
  • 6