gpt4 book ai didi

java - 多个 SLF4J 绑定(bind) intellij linux

转载 作者:太空宇宙 更新时间:2023-11-04 13:04:53 25 4
gpt4 key购买 nike

我正在尝试运行由 IntelliJ idea 中的 gradle 生成的 war 。

当我通过 idea 的 tomcat 运行配置运行 war 时,我得到如下 SLF4J 多重绑定(bind)警告:

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]

websitebase-app-1.0.0.war 中的 SLF4J 是我的应用程序中的那个。来自/usr/share/java 的 SLF4J 绑定(bind)是我不想要的附加 SLF4J 绑定(bind)。我不知道如何删除它们,因为当我从 gradle 运行应用程序时,我没有在运行时包含它们。

我如何配置我的应用程序或 IntelliJ idea,而不包含那些额外的 SLF4J 绑定(bind)?

我正在尝试在 IntelliJ 中启动应用程序。我在 IntelliJ 中创建了一个运行配置,它使用我本地安装的 tomcat7。我从存储库安装了 tomcat,我正在运行 NetRunner 16,它是 Kubuntu 的一个发行版。

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

最佳答案

这里有几个解决方案:

  • 确保在类路径中只包含一个 slf4j 依赖项。
  • 如果您的项目依赖于其他项目并且另一个项目使用 slf4j 以及不同版本尝试使用 excusion
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>

关于java - 多个 SLF4J 绑定(bind) intellij linux,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32960545/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com