我正在尝试完成某些模型的一些基本单元测试。但是我收到以下错误。现在看来我有两个SLF4J绑定。这是因为我使用的Mahout有一个版本的SLF4J,Play有自己的版本。
有谁能告诉我如何解决这个问题?
SLF4J:有关解释,请参阅http://www.slf4j.org/codes.html#multiple_bindings。 SLF4J:在类路径上检测到jcl-over-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
答案 0 :(得分:7)
尝试
"org.apache.mahout" % "mahout-core" % "0.7" excludeAll(ExclusionRule(organization = "org.slf4j"))
让你的mahout依赖。
Play中有更多关于图书馆管理的信息(它使用SBT):https://github.com/harrah/xsbt/wiki/Library-Management