我已经通过公开的dbt-model生成了导入到intellij的scala项目。在控制台测试运行正常,但在intellij java.lang.ClassNotFoundException:org.slf4j.LoggerFactory,更无聊:
java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
at play.api.Logger$.<init>(Logger.scala:182)
at play.api.Logger$.<clinit>(Logger.scala)
at play.api.Application$class.$init$(Application.scala:272)
at play.api.test.FakeApplication.<init>(Fakes.scala:221)
at play.api.test.WithApplication$.$lessinit$greater$default$1(Specs.scala:20)
at UserTest$$anonfun$1$$anonfun$apply$1$$anon$1.<init>(UserTest.scala:10)
at UserTest$$anonfun$1$$anonfun$apply$1.apply(UserTest.scala:10)
at UserTest$$anonfun$1$$anonfun$apply$1.apply(UserTest.scala:10)Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
sj4j由sbt附加到intellij。诀窍在哪里?
答案 0 :(得分:1)
您可能只包含对SLF4J API的依赖关系,但您还必须包含执行实际日志记录工作的实现。
libraryDependencies += "org.slf4j" % "slf4j-log4j12" % "1.7.10"
我建议你使用logback-classic:
libraryDependencies += "ch.qos.logback" % "logback-classic" % "1.1.2"
版本可能不正确。