我正在使用 JBoss 6 并在尝试运行我的应用程序时收到多个版本错误:
ERROR [STDERR] SLF4J: Class path contains multiple SLF4J bindings.
ERROR [STDERR] SLF4J: Found binding in [vfs:/C:/jboss-6.0.0.Final/common/lib/slf4j-jboss-logmanager.jar/org/slf4j/impl/StaticLoggerBinder.class]
ERROR [STDERR] SLF4J: Found binding in [vfs:/C:/jboss-6.0.0.Final/server/default/deploy/newsroom-integration-persistence-service.war/WEB-INF/lib/slf4j-log4j12-1.6.1.jar/org/slf4j/impl/StaticLoggerBinder.class]
我的应用程序在 pom 中声明了 slf4j-log4j12 但没有声明 slf4j-jboss-logmanager 所以不知道为什么要尝试使用它。这是 pom:
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${org.slf4j-version}</version>
<scope>runtime</scope>
</dependency>
关于如何解决这个问题的任何想法?即使在 jboss-logging.xml 中设置的级别名称设置为 INFO,它似乎也会导致 'DEBUG' 级别的错误被写入控制台!
最佳答案
无论您在pom.xml
中声明什么,JBoss 都会加载其公共(public)类路径中的内容。如果您更喜欢使用 log4j
绑定(bind),那么您必须删除 C:/jboss-6.0.0.Final/common/lib/slf4j-jboss-logmanager.jar
.这是Alfresco推荐的方法.引用:
You may see the following errors during the startup:
2011-10-12 10:47:21,505 ERROR [STDERR] (main) SLF4J: Class path contains multiple SLF4J bindings.
2011-10-12 10:47:21,505 ERROR [STDERR] (main) SLF4J: Found binding in [vfszip:/usr/local/jeap51/jboss- as/common/lib/slf4j-jboss-logging.jar/org/slf4j/impl/StaticLoggerBinder.class]
2011-10-12 10:47:21,505 ERROR [STDERR] (main) SLF4J: Found binding in [vfszip:/usr/local/jeap51/jboss -as/server/W51J51I1/deploy/alfresco.war/WEB-INF/lib/slf4j-log4j12-1.5.11.jar/org/slf4j/impl/StaticLoggerBinder.class]
2011-10-12 10:47:21,505 ERROR [STDERR] (main) SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
To avoid these errors, remove the /common/lib/slf4j-jboss-logging.jar file.
关于java - JBoss 多个 SLF4J 绑定(bind)错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23407285/