PlayFramework多SLF4J绑定(PlayFramework Multiple SLF4J

2019-09-23 16:11发布

我试图完成一些车型的一些基本的单元测试。 然而,我发现了以下错误。 现在看来,我有两个绑定SLF4J。 这是因为我使用Mahout的具有SLF4J的一个版本,游戏都有自己的版本。

谁能告诉我怎样才能解决这个问题呢?

SLF4J:见http://www.slf4j.org/codes.html#multiple_bindings一个解释。 SLF4J:都检测到JCL-过slf4j.jar和SLF4J-jcl.jar类路径,抢占的StackOverflowError。 SLF4J:又见http://www.slf4j.org/codes.html#jclDelegationLoop了解更多详情。

java.lang.ExceptionInInitializerError
at org.slf4j.impl.StaticLoggerBinder.<init>(StaticLoggerBinder.java:82)
at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:51)
at org.slf4j.LoggerFactory.bind(LoggerFactory.java:121)
at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:111)
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:268)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:241)
at play.api.Logger$.<init>(Logger.scala:178)
at play.api.Logger$.<clinit>(Logger.scala)
at play.api.Application.<init>(Application.scala:106)
at play.api.test.FakeApplication.<init>(Fakes.scala:141)
at play.test.FakeApplication.<init>(FakeApplication.java:24)
at play.test.Helpers.fakeApplication(Helpers.java:86)
at databaseTest.startApp(databaseTest.java:31)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.ParentRunner.run(ParentRunner.java:292)
at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:71)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:199)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:62)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)

Caused by: java.lang.IllegalStateException: Detected both jcl-over-slf4j.jar AND slf4j-jcl.jar on the class path, preempting StackOverflowError. See also http://www.slf4j.org/codes.html#jclDelegationLoop for more details.
at org.slf4j.impl.JCLLoggerFactory.<clinit>(JCLLoggerFactory.java:64)
... 32 more

Answer 1:

尝试

"org.apache.mahout" % "mahout-core" % "0.7" excludeAll(ExclusionRule(organization = "org.slf4j"))

让你的象夫的依赖。

还有更多关于游戏库管理(它使用SBT): https://github.com/harrah/xsbt/wiki/Library-Management



文章来源: PlayFramework Multiple SLF4J bindings