【发布时间】:2018-09-24 08:58:06
【问题描述】:
当我从 sbt 运行时
(sbt 运行)
我的 akka http 服务运行良好,但是使用 jar 运行时出现以下错误
(java -jar myservice.jar)
由 publishLocal 创建
(sbt publishLocal)
Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
at com.rogers.profileauthn.StartProfileAuthService.<clinit>(StartProfileAuthService.java:15)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
sbt 文件中的依赖关系如下
val akkaVersion = "2.5.11"
val akkaHttpVersion = "10.0.11"
libraryDependencies ++= Seq(
"ch.qos.logback" % "logback-classic" % "1.2.3",
"com.typesafe.akka" %% "akka-http" % akkaHttpVersion,
"com.typesafe.akka" %% "akka-stream" % akkaVersion,
"com.typesafe.akka" %% "akka-http-jackson" % akkaHttpVersion,
"com.typesafe.akka" %% "akka-http-testkit" % akkaHttpVersion % Test,
"com.typesafe.akka" %% "akka-testkit" % akkaVersion % Test,
"junit" % "junit" % "4.12" % Test,
"com.novocode" % "junit-interface" % "0.10" % Test,
"com.typesafe.play" %% "play-json" % "2.6.9",
"com.github.swagger-akka-http" %% "swagger-akka-http" % "0.11.0",
"com.google.inject" % "guice" % "4.1.0",
"com.google.guava" % "guava" % "18.0",
"org.mockito" % "mockito-core" % "2.11.0"
)
我正在使用的记录器如下
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
...
private static final Logger LOGGER = LoggerFactory.getLogger(StartService.class);
LOGGER.info("**** StartService.createAndStartActorSystem Starts ****");
【问题讨论】:
标签: java scala sbt akka akka-http