我升级了Play和其他库的版本,现在看到了这个:
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/paul/.ivy2/cache/org.slf4j/slf4j-nop/jars/slf4j-nop-1.7.7.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/paul/.ivy2/cache/org.slf4j/slf4j-jdk14/jars/slf4j-jdk14-1.7.7.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/paul/.ivy2/cache/org.slf4j/slf4j-simple/jars/slf4j-simple-1.7.7.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 [org.slf4j.helpers.NOPLoggerFactory]
我试图追踪这些文件的来源,但当我运行<code>show managed classpath
/home/paul/.ivy2/cache/org.slf4j/slf4j-api/jars/slf4j-api-1.7.6.jar
/home/paul/.ivy2/cache/org.slf4j/jul-to-slf4j/jars/jul-to-slf4j-1.7.6.ja
/home/paul/.ivy2/cache/org.slf4j/jcl-over-slf4j/jars/jcl-over-slf4j-1.7.6.jar
我从未见过slf4j-nop-1.7.7.jar
或slf4j-jdk14-1.1.7.jar
或slf4j-simple-1.6.7.jar
。
这些在类路径上怎么样?
根据这些评论和可能的解决方案,我可以建议将我的解决方案包含在< code>build.sbt中,供未修复版本的用户使用,例如Play 2.3.2:
libraryDependencies ++= Seq(
"org.slf4j" % "slf4j-api" % "1.7.7",
"org.slf4j" % "jcl-over-slf4j" % "1.7.7"
).map(_.force())
libraryDependencies ~= { _.map(_.exclude("org.slf4j", "slf4j-jdk14")) }
之前:
--- (Running the application from SBT, auto-reloading is enabled) ---
[info] play - Listening for HTTP on /0:0:0:0:0:0:0:0:9000
(Server started, use Ctrl+D to stop and go back to the console...)
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/Users/jacek/.ivy2/cache/org.slf4j/slf4j-nop/jars/slf4j-nop-1.7.7.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/Users/jacek/.ivy2/cache/org.slf4j/slf4j-jdk14/jars/slf4j-jdk14-1.7.7.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/Users/jacek/.ivy2/cache/org.slf4j/slf4j-simple/jars/slf4j-simple-1.7.7.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 [org.slf4j.helpers.NOPLoggerFactory]
[info] play - Application started (Dev)
之后(变更后):
--- (Running the application from SBT, auto-reloading is enabled) ---
[info] play - Listening for HTTP on /0:0:0:0:0:0:0:0:9000
(Server started, use Ctrl+D to stop and go back to the console...)
[info] play - Application started (Dev)
这些是项目的依赖项:
$show libraryDependencies[info]列表(org.scala.lang:scala库:2.11.2,com.typesafe.play:twirl api:1.0.2,com.typesafe.play:play:2.3.2,com.typesafe.play:play test:2.2.2:test,com.typesafe.play:play docs:2.1.2:docs,com.2,com.typesafe.play:过滤器和助手:2.3.2,org.webjars:webjars play:2.3.0,org.webjars:requirejs:2.1.14-1,org.webjars:UndermarkeJS:1.6.0-3,org.webjars:jquery:2.2.1,org.webjars:bootstrap:3.2.0,org。17,org.postgresql:postgresq:9.3-1102-jdbc41,org.slf4j:slf4japi:1.7.7,org.slf4j:jcl-over-slf4j:1.6.7)
我得到以下错误。似乎有多个日志记录框架绑定到SLF4J。不知道该怎么解决。非常感谢任何帮助。
我在运行java代码时遇到以下运行时异常。有人能帮我解决绑定冲突吗。
我在netbeans中有一个纯Java项目,我得到的警告是: 当然,我搜索了警告,但所有的答案都与用maven或pom.xml文件删除重复绑定有关。但是我没有pom.xml文件,也没有使用Maven。 那么如何排除绑定呢?
我不断得到错误:
当我尝试在eclipse中运行junit测试时,出现以下错误: SLF4J:类路径包含多个SLF4J绑定。SLF4J:在[jar: file:/C:/User/MaximilianBecker/. m2/repository/uk/org/lidalia/slf4j-test/1.2.0/slf4j-test-1.2.0.jar中找到绑定! /org/slf4j/impl/StaticLogger
我在其他问题中看到,通常此警告的解决方案是从导致此冲突的依赖项中排除slf4j,但我无法在我的项目中发现问题。 我运行命令,输出如下: