2015-10-06 57 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>