scala – java.lang.ClassNotFoundException:play.core.server.NettyServer,当更多播放库添加到build.sbt时

我是
Scala,SBT和Play的新手,所以请将其视为NooB questtion.我正在为竞赛构建一个示例Play应用程序,并以reactive-stocks应用程序作为模板开始.为了自然地扩展其功能,我需要添加安全性,JDBC连接等.

这是模板中提供的原始build.sbt文件 –

scalaVersion := "2.11.1"

libraryDependencies ++= Seq(
  ws, // Play's web services module
  "com.typesafe.akka" %% "akka-actor" % "2.3.4",
  "com.typesafe.akka" %% "akka-slf4j" % "2.3.4",
  "org.webjars" % "bootstrap" % "2.3.1",
  "org.webjars" % "flot" % "0.8.0",
  "com.typesafe.akka" %% "akka-testkit" % "2.3.4" % "test"
)

在此我将“com.typesafe.play”%“anorm_2.11”%“2.4.0-M1”添加到slf4j依赖项之后的列表中,并且应用程序能够编译并运行.

现在,如果我添加任何“com.typesafe.play”%“filters-helpers_2.11”%“2.4.0-M1”或“com.typesafe.play”%“play-jdbc_2.11”%“2.4.0 -M1\”
播放应用程序无法在Activator web ui中编译,消息为“(echo:run)java.lang.ClassNotFoundException:play.core.server.NettyServer”.

Netty Server类肯定在类路径中.那有什么问题呢?

我正在使用JDK 8.失败的配置是

scalaVersion := "2.11.1"

libraryDependencies ++= Seq(
  ws, // Play's web services module
  "com.typesafe.akka" %% "akka-actor" % "2.3.4",
  "com.typesafe.akka" %% "akka-slf4j" % "2.3.4",
  "org.webjars" % "bootstrap" % "2.3.1",
  "org.webjars" % "flot" % "0.8.0",
  "com.typesafe.akka" %% "akka-testkit" % "2.3.4" % "test",
  "com.typesafe.play" % "anorm_2.11" % "2.4.0-M1",
  "com.typesafe.play" % "filters-helpers_2.11" % "2.4.0-M1",
  "com.typesafe.play" % "play-jdbc_2.11" % "2.4.0-M1"
)

与日志

Reapplying settings...
Set current project to reactive-stocks (in build file:/D:/Miura/reactive-stocks/)
Reapplying settings...
Set current project to reactive-stocks (in build file:/D:/Miura/reactive-stocks/)
Reapplying settings...
Set current project to reactive-stocks (in build file:/D:/Miura/reactive-stocks/)
Reapplying settings...
Set current project to reactive-stocks (in build file:/D:/Miura/reactive-stocks/)
Running task... Cancel: sbt.TaskCancellationStrategy$Null$@571cf19b, check cycles: false
play.core.server.NettyServer
(echo:run) java.lang.ClassNotFoundException: play.core.server.NettyServer
Run complete.

最佳答案 正如在
Google group上回答的那样,问题在于混合了Play库版本.股票模板适用于Play 2.3.3,但我试图添加的库是2.4.

build.sbt中的此配置有效

    libraryDependencies ++= Seq(
     jdbc,
     anorm,
     cache,
     ws
点赞