PlayFramework多个SLF4J绑定 [英] PlayFramework Multiple SLF4J bindings

查看:116
本文介绍了PlayFramework多个SLF4J绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试完成某些模型的一些基本单元测试.但是我收到以下错误.现在看来,我有两个SLF4J绑定.这是因为我使用的Mahout具有SLF4J的一个版本,而Play具有其自己的版本.

I'm trying to complete some basic unit tests of some models. However I'm getting the following error. Now it appears I have two bindings for SLF4J. This is because I am using Mahout which has one version of SLF4J and Play has its own version.

谁能告诉我如何解决这个问题?

Can anyone tell me how I can resolve this problem?

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 有关更多详细信息.

SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. SLF4J: Detected both jcl-over-slf4j.jar AND slf4j-jcl.jar on the class path, preempting StackOverflowError. SLF4J: See also http://www.slf4j.org/codes.html#jclDelegationLoop for more details.

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

推荐答案

尝试

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

获取您的mahout依赖项.

to get your mahout dependency.

有关Play中的图书馆管理的更多信息(它使用SBT): https://github.com/harrah /xsbt/wiki/Library-Management

There is more about library management in Play (it uses SBT): https://github.com/harrah/xsbt/wiki/Library-Management

这篇关于PlayFramework多个SLF4J绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆