我有一个错误“类路径包含多个SLF4J绑定。”启动我的Web应用服务器时。我在这里找到的解决办法似乎不起作用。我已经从域中排除了工件,但仍然得到错误。我不明白为什么我有错误即使排除在外。我使用Glassfish 4.1.1作为服务器。
Severe: SLF4J: Class path contains multiple SLF4J bindings.
Severe: SLF4J: Found binding in [jar:file:/C:/glassfish4.1.1/glassfish/domains/domain1/eclipseApps/csbasement/WEB-INF/lib/slf4j-log4j12-1.7.12.jar!/org/slf4j/impl/StaticLoggerBinder.class]
Severe: SLF4J: Found binding in [jar:file:/C:/glassfish4.1.1/glassfish/domains/domain1/eclipseApps/csbasement/WEB-INF/lib/slf4j-simple-1.7.12.jar!/org/slf4j/impl/StaticLoggerBinder.class]
Severe: SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
我排除了在错误代码中提供的链接中看到的工件:
<!-- slf4j -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.12</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.12</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
MVN:树:
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ maventest ---
[INFO] maventest:maventest:jar:0.0.1-SNAPSHOT
[INFO] +- org.omnifaces:omnifaces:jar:2.1:compile
[INFO] +- org.webjars:font-awesome:jar:4.4.0:compile
[INFO] +- org.ocpsoft.rewrite:rewrite-servlet:jar:2.0.12.Final:compile
[INFO] +- org.ocpsoft.rewrite:rewrite-config-prettyfaces:jar:2.0.12.Final:compile
[INFO] | +- org.ocpsoft.rewrite:rewrite-annotations-impl:jar:2.0.12.Final:compile
[INFO] | | +- org.ocpsoft.rewrite:rewrite-api:jar:2.0.12.Final:compile
[INFO] | | | +- org.ocpsoft.common:common-api:jar:1.0.5.Final:compile
[INFO] | | | \- org.ocpsoft.logging:logging-api:jar:1.0.2.Final:compile
[INFO] | | +- org.ocpsoft.rewrite:rewrite-api-servlet:jar:2.0.12.Final:compile
[INFO] | | | \- org.ocpsoft.rewrite:rewrite-addressbuilder:jar:2.0.12.Final:compile
[INFO] | | \- org.ocpsoft.rewrite:rewrite-annotations-api:jar:2.0.12.Final:compile
[INFO] | \- org.ocpsoft.rewrite:rewrite-integration-faces:jar:2.0.12.Final:compile
[INFO] +- commons-io:commons-io:jar:2.4:compile
[INFO] +- org.primefaces:primefaces:jar:5.3:compile
[INFO] +- org.apache.httpcomponents:httpclient:jar:4.5:compile
[INFO] | +- org.apache.httpcomponents:httpcore:jar:4.4.1:compile
[INFO] | +- commons-logging:commons-logging:jar:1.2:compile
[INFO] | \- commons-codec:commons-codec:jar:1.9:compile
[INFO] +- com.google.guava:guava:jar:18.0:compile
[INFO] +- org.twitter4j:twitter4j-core:jar:4.0.4:compile
[INFO] +- org.twitter4j:twitter4j-stream:jar:4.0.4:compile
[INFO] +- com.twitter:hbc-core:jar:2.2.0:compile
[INFO] | +- com.twitter:joauth:jar:6.0.2:compile
[INFO] | \- com.google.code.findbugs:jsr305:jar:1.3.9:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.7.12:compile
[INFO] +- org.slf4j:slf4j-simple:jar:1.7.12:compile
[INFO] +- org.jsoup:jsoup:jar:1.8.2:compile
[INFO] +- com.ocpsoft:ocpsoft-pretty-time:jar:1.0.7:compile
[INFO] +- jstl:jstl:jar:1.2:compile
[INFO] \- com.google.code.gson:gson:jar:2.3.1:compile
这里是我的整个pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>maventest</groupId>
<artifactId>maventest</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<!-- omnifaces -->
<dependency>
<groupId>org.omnifaces</groupId>
<artifactId>omnifaces</artifactId>
<version>2.1</version>
</dependency>
<!-- font awesome -->
<dependency>
<groupId>org.webjars</groupId>
<artifactId>font-awesome</artifactId>
<version>4.4.0</version>
</dependency>
<dependency>
<groupId>org.ocpsoft.rewrite</groupId>
<artifactId>rewrite-servlet</artifactId>
<version>2.0.12.Final</version>
</dependency>
<dependency>
<groupId>org.ocpsoft.rewrite</groupId>
<artifactId>rewrite-config-prettyfaces</artifactId>
<version>2.0.12.Final</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>5.3</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5</version>
</dependency>
<!-- twitter -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>18.0</version>
</dependency>
<dependency>
<groupId>org.twitter4j</groupId>
<artifactId>twitter4j-core</artifactId>
<version>4.0.4</version>
</dependency>
<dependency>
<groupId>org.twitter4j</groupId>
<artifactId>twitter4j-stream</artifactId>
<version>4.0.4</version>
</dependency>
<dependency>
<groupId>com.twitter</groupId>
<artifactId>hbc-twitter4j</artifactId>
<version>2.2.0</version>
</dependency>
<dependency>
<groupId>com.twitter</groupId>
<artifactId>hbc-core</artifactId> <!-- or hbc-twitter4j -->
<version>2.2.0</version> <!-- or whatever the latest version is -->
</dependency>
<!-- slf4j -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.12</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.12</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
您正在构建.jar
,并且通常如果.jar
不是一个端点独立应用程序(即您通常从Java-jar myjar.jar
开始,而您将其作为另一个依赖项添加到WAR
web应用程序中),则不应该包含slf4j实现。因此,只需删除slf4j-simple
依赖项。
我得到以下错误。似乎有多个日志记录框架绑定到SLF4J。不知道该怎么解决。非常感谢任何帮助。
我的应用程序服务器ibm WebSphere。我在应用程序服务器日志中得到以下错误。哪里可以设置websphere? [19.09.2012 14:56:54:940 EEST]0000000a SystemErr R SLF4J:类路径包含多个SLF4J绑定。 [19.09.2012 14:56:54:940 EEST]0000000a SystemErr R SLF4J:在[wsjar:fil
我在运行java代码时遇到以下运行时异常。有人能帮我解决绑定冲突吗。
我在netbeans中有一个纯Java项目,我得到的警告是: 当然,我搜索了警告,但所有的答案都与用maven或pom.xml文件删除重复绑定有关。但是我没有pom.xml文件,也没有使用Maven。 那么如何排除绑定呢?
我不断得到错误:
我在其他问题中看到,通常此警告的解决方案是从导致此冲突的依赖项中排除slf4j,但我无法在我的项目中发现问题。 我运行命令,输出如下: