2015-10-06 56 views
0

我想从IntelliJ想法运行由gradle生成的战争。多个SLF4J绑定intellij linux

当我运行过的想法的Tomcat运行配置的战争中,我得到了SLF4J多个绑定警告如下:

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绑定是我不想要的其他SLF4J绑定。我不知道如何删除它们,因为当我从gradle运行应用程序时,我没有在运行时包含这些应用程序。

如何配置我的应用程序或IntelliJ的想法,而不是包含那些额外的SLF4J绑定?

我想在IntelliJ中启动应用程序。我在IntelliJ中创建了一个使用我本地安装的tomcat7的运行配置。我从存储库安装了tomcat,我运行的是Kubuntu发行的NetRunner 16。 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 
+0

哪里tomcat的从何而来?它是一个分发包吗? –

+0

tomcat7 7.0.56-2ubuntu0.1我使用的是Kubuntu发行的Netrunner 16。 –

+0

某种程度上,路径“/ usr/share/java/*”出现在你的类路径中,不确定是否intellij做到了,或者你改变了tomcat设置。你可以为那个正在运行的tomcat提供'jps -v'输出吗? –

回答

0

有几个解决方案在这里:

  • 确保您在类路径中只有一个SLF4J依赖。
  • 如果你的项目上的其他项目,另一种使用SLF4J的依赖,以及与不同版本的尝试使用excusion
<exclusions> 
    <exclusion> 
     <groupId>org.slf4j</groupId> 
     <artifactId>slf4j-api</artifactId> 
    </exclusion> 
</exclusions>