我的设置是 IntelliJ IDEA 11 中的 java 1.6.0_45、richfaces 4.3.2、jsf 2.1.5、tomcat 7.0.30。
我面临以下异常:
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)
...
我在这里搜索过,我发现最接近的问题是:
-这里和这里
两个帖子基本上都解决了相同的问题。该文件在项目文件夹中的csv.xml
多个 JAR 中被引用。/WEB-INF/lib
我写了一个小脚本来“jar tf”我的 lib 目录中的每个文件,将输出管道输出到一个 grep for csv.xml
,它只显示一个条目。
这是我的/WEB-INF/lib
文件夹的屏幕截图:
为什么我仍然会收到此异常,我该如何解决?
我正在使用的类路径如下:
-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
开始
只是为了好玩,我运行相同的脚本在所有包含的 tomcat 路径中搜索“csv.xml”,但没有出现。我认为在 java home 位置也运行它会有点矫枉过正。
我还将项目导出到战争中,但我仍然遇到同样的问题。我爆破了war文件,在/WEB-INF/lib目录下查找,发现如下:
这应该准确地表明正在使用哪些罐子。据我所知,这些 jar 文件都不应该与富面孔库有任何冲突。我针对这个目录运行了我的 csv.xml 搜索脚本,它再次找到了一个条目。