当前位置: 首页 > 知识库问答 >
问题:

多个SLF4J绑定intellij linux

黄景胜
2023-03-14

我正在尝试运行gradle从IntelliJ IDEA生成的战争。

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/share/java/slf4j-jcl-1.7.7.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/share/java/slf4j-jdk14-1.7.7.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/share/java/slf4j-simple-1.7.7.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/share/java/slf4j-nop-1.7.7.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/share/java/slf4j-log4j12-1.7.7.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/share/java/logback-classic-1.1.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/virtue/prog/idea_project/out/artifacts/websitebase-app/exploded/websitebase-app-1.0.0.war/WEB-INF/lib/logback-classic-1.1.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]

tomcat实例运行时jps-v的输出:

5281 Jps -Dapplication.home=/usr/lib/jvm/java-8-oracle -Xms8m
4808 RemoteMavenServer -Djava.awt.headless=true -Didea.version==14.1.5 -Xmx512m -Didea.maven.embedder.version=3.0.5 -Dfile.encoding=UTF-8
5164 Launcher -Xmx700m -Djava.awt.headless=true -Djava.endorsed.dirs="" -Djdt.compiler.useSingleThread=true -Dpreload.project.path=/home/virtue/prog/idea_project -Dpreload.config.path=/home/virtue/.IntelliJIdea14/config/options -Dcompile.parallel=false -Drebuild.on.dependency.change=true -Djava.net.preferIPv4Stack=true -Dio.netty.initialSeedUniquifier=7407435799211631797 -Dfile.encoding=UTF-8 -Djps.file.types.component.name=FileTypeManager -Duser.language=en -Duser.country=CA -Didea.paths.selector=IntelliJIdea14 -Didea.home.path=/home/virtue/devtools/idea/idea-IU-141.2735.5 -Didea.config.path=/home/virtue/.IntelliJIdea14/config -Didea.plugins.path=/home/virtue/.IntelliJIdea14/config/plugins -Djps.log.dir=/home/virtue/.IntelliJIdea14/system/log/build-log -Djava.io.tmpdir=/home/virtue/.IntelliJIdea14/system/compile-server/_temp_
4669 Main -Xbootclasspath/a:/home/virtue/devtools/idea/idea-IU-141.2735.5/bin/../lib/boot.jar -Xms128m -Xmx750m -XX:MaxPermSize=350m -XX:ReservedCodeCacheSize=225m -XX:+UseConcMarkSweepGC -XX:SoftRefLRUPolicyMSPerMB=50 -ea -Dsun.io.useCanonCaches=false -Djava.net.preferIPv4Stack=true -Dawt.useSystemAAFontSettings=lcd -Djb.vmOptionsFile=/home/virtue/devtools/idea/idea-IU-141.2735.5/bin/idea64.vmoptions -XX:ErrorFile=/home/virtue/java_error_in_IDEA_%p.log -Djb.restart.code=88 -Didea.paths.selector=IntelliJIdea14
4958 GradleDaemon -XX:MaxPermSize=1024m -Dfile.encoding=UTF-8 -Duser.country=CA -Duser.language=en -Duser.variant
5167 Bootstrap -Djava.util.logging.config.file=/home/virtue/.IntelliJIdea14/system/tomcat/Unnamed_marble-gradle-common_3/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:48465,suspend=y,server=n -javaagent:/home/virtue/devtools/idea/idea-IU-141.2735.5/plugins/Groovy/lib/agent/gragent.jar -Dcom.sun.management.jmxremote= -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.rmi.server.hostname=127.0.0.1 -Djava.endorsed.dirs=/usr/share/tomcat7/endorsed -Dcatalina.base=/home/virtue/.IntelliJIdea14/system/tomcat/Unnamed_marble-gradle-common_3 -Dcatalina.home=/usr/share/tomcat7 -Djava.io.tmpdir=/home/virtue/.IntelliJIdea14/system/tomcat/Unnamed_marble-gradle-common_3/temp

共有1个答案

巫欣荣
2023-03-14

这里有两种解决方案

  • 确保在类路径中只包含一个slf4j依赖项。
  • 如果您的项目依赖于其他项目,而其他项目也使用slf4j,并且版本不同,请尝试使用Excustion
<exclusions>
   <exclusion>
       <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
    </exclusion>
</exclusions>
 类似资料:
  • 这可能是一个重复的问题,但我无法弄清楚绑定冲突在哪里。我有我的服务,当我运行它时,我得到了这个错误: 这是输出 显然,问题在于<code>logback</code>仍然在类路径中,但我在输出中找不到它,所以我不知道问题出在哪里。 你能发现错误吗?我将感谢你的帮助 这仅在我将服务器作为Spring Boot Application运行时发生。如果我将其作为java应用程序运行,错误就消失了....

  • 我正在使用JBoss6,但在尝试运行我的应用程序时遇到一个多版本错误: 错误[STDERR]SLF4J:类路径包含多个SLF4J绑定。 错误[STDERR]slf4j:在[vfs:/c:/jboss-6.0.0.final/common/lib/slf4j-jboss-logmanager.jar/org/slf4j/impl/staticloggerbinder.class]中找到绑定 错误[S

  • 环境详细信息: IBM Worklight 6.2 但这不是解决办法。请提出解决方法。

  • 我得到以下错误。似乎有多个日志记录框架绑定到SLF4J。不知道该怎么解决。非常感谢任何帮助。

  • 我在运行java代码时遇到以下运行时异常。有人能帮我解决绑定冲突吗。

  • 我在netbeans中有一个纯Java项目,我得到的警告是: 当然,我搜索了警告,但所有的答案都与用maven或pom.xml文件删除重复绑定有关。但是我没有pom.xml文件,也没有使用Maven。 那么如何排除绑定呢?