scala.tools.reflect.ToolBoxError 异常
scala.tools.reflect.ToolBoxError exception
我遇到了一个问题,无法解决。
今天,我在构建项目时遇到错误。主题中描述了此错误:
据我所知,新版本的 scala 已发布 (2.12.0-M1) 并且依赖关系已被破坏。
这个问题的答案是使用代码覆盖 "org.scala-lang" 和 "scala-compiler" 依赖项:
dependencyOverrides += "org.scala-lang" % "scala-compiler" % scalaVersion.value
我的 scalaVersion 是 scalaVersion := "2.11.1"
。
这解决了构建项目的问题。
服务器成功运行,但是当我尝试调用 DB
对象(扩展 Instance
)来执行查询时,我得到一个异常:
play.api.Application$$anon: Execution exception[[RuntimeException: java.lang.ExceptionInInitializerError]]
at play.api.Application$class.handleError(Application.scala:296) ~[play_2.11-2.3.7.jar:2.3.7]
at play.api.DefaultApplication.handleError(Application.scala:402) [play_2.11-2.3.7.jar:2.3.7]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$$anonfun$applyOrElse.apply(PlayDefaultUpstreamHandler.scala:320) [play_2.11-2.3.7.jar:2.3.7]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$$anonfun$applyOrElse.apply(PlayDefaultUpstreamHandler.scala:320) [play_2.11-2.3.7.jar:2.3.7]
at scala.Option.map(Option.scala:146) [scala-library-2.11.6.jar:na]
Caused by: java.lang.RuntimeException: java.lang.ExceptionInInitializerError
at play.api.mvc.ActionBuilder$$anon.apply(Action.scala:523) ~[play_2.11-2.3.7.jar:2.3.7]
at play.api.mvc.Action$$anonfun$apply$$anonfun$apply$$anonfun$apply.apply(Action.scala:130) ~[play_2.11-2.3.7.jar:2.3.7]
at play.api.mvc.Action$$anonfun$apply$$anonfun$apply$$anonfun$apply.apply(Action.scala:130) ~[play_2.11-2.3.7.jar:2.3.7]
at play.utils.Threads$.withContextClassLoader(Threads.scala:21) ~[play_2.11-2.3.7.jar:2.3.7]
at play.api.mvc.Action$$anonfun$apply$$anonfun$apply.apply(Action.scala:129) ~[play_2.11-2.3.7.jar:2.3.7]
Caused by: java.lang.ExceptionInInitializerError: null
at models.dao.UserDAO$.getUser(UserDAO.scala:32) ~[classes/:na]
at controllers.User$$anonfun$login.apply(User.scala:82) ~[classes/:na]
at controllers.User$$anonfun$login.apply(User.scala:80) ~[classes/:na]
at play.api.mvc.ActionBuilder$$anonfun$apply.apply(Action.scala:433) ~[play_2.11-2.3.7.jar:2.3.7]
at play.api.mvc.ActionBuilder$$anonfun$apply.apply(Action.scala:432) ~[play_2.11-2.3.7.jar:2.3.7]
Caused by: scala.tools.reflect.ToolBoxError: reflective compilation has failed: cannot initialize the compiler due to java.lang.VerifyError: scala/tools/reflect/ToolBoxFactory$ToolBoxImpl$ToolBoxGlobal
at scala.tools.reflect.ToolBoxFactory$ToolBoxImpl$withCompilerApi$api$.liftedTree1(ToolBoxFactory.scala:344) ~[scala-compiler-2.11.1.jar:na]
at scala.tools.reflect.ToolBoxFactory$ToolBoxImpl$withCompilerApi$api$.compiler$lzycompute(ToolBoxFactory.scala:330) ~[scala-compiler-2.11.1.jar:na]
at scala.tools.reflect.ToolBoxFactory$ToolBoxImpl$withCompilerApi$api$.compiler(ToolBoxFactory.scala:329) ~[scala-compiler-2.11.1.jar:na]
at scala.tools.reflect.ToolBoxFactory$ToolBoxImpl$withCompilerApi$.liftedTree2(ToolBoxFactory.scala:356) ~[scala-compiler-2.11.1.jar:na]
at scala.tools.reflect.ToolBoxFactory$ToolBoxImpl$withCompilerApi$.apply(ToolBoxFactory.scala:354) ~[scala-compiler-2.11.1.jar:na]
Caused by: java.lang.VerifyError: scala/tools/reflect/ToolBoxFactory$ToolBoxImpl$ToolBoxGlobal
at scala.tools.reflect.ToolBoxFactory$ToolBoxImpl$withCompilerApi$api$.liftedTree1(ToolBoxFactory.scala:334) ~[scala-compiler-2.11.1.jar:na]
at scala.tools.reflect.ToolBoxFactory$ToolBoxImpl$withCompilerApi$api$.compiler$lzycompute(ToolBoxFactory.scala:330) ~[scala-compiler-2.11.1.jar:na]
at scala.tools.reflect.ToolBoxFactory$ToolBoxImpl$withCompilerApi$api$.compiler(ToolBoxFactory.scala:329) ~[scala-compiler-2.11.1.jar:na]
at scala.tools.reflect.ToolBoxFactory$ToolBoxImpl$withCompilerApi$.liftedTree2(ToolBoxFactory.scala:356) ~[scala-compiler-2.11.1.jar:na]
at scala.tools.reflect.ToolBoxFactory$ToolBoxImpl$withCompilerApi$.apply(ToolBoxFactory.scala:354) ~[scala-compiler-2.11.1.jar:na]
我认为这与 scala 更新和配置问题有关,因为昨天我使用相同的服务,没有任何异常。
我的build.sbt
:
name := """XXXX"""
version := "1.0-SNAPSHOT"
lazy val root = (project in file(".")).enablePlugins(PlayScala)
scalaVersion := "2.11.1"
dependencyOverrides += "org.scala-lang" % "scala-compiler" % scalaVersion.value
libraryDependencies ++= Seq(
jdbc,
anorm,
cache,
ws,
"org.sorm-framework" % "sorm" % "0.3.18",
"com.typesafe.play" %% "play-mailer" % "2.4.0",
"com.typesafe.play" %% "play-json" % "2.3.7",
"postgresql" % "postgresql" % "9.1-901.jdbc4",
"com.sksamuel.scrimage" %% "scrimage-core" % "1.4.2",
"com.sksamuel.scrimage" %% "scrimage-canvas" % "1.4.2",
"com.sksamuel.scrimage" %% "scrimage-filters" % "1.4.2",
"com.notnoop.apns" % "apns" % "1.0.0.Beta6",
"org.scalatest" % "scalatest_2.11" % "2.2.4" % "test"
)
知道为什么会这样吗?
谢谢
我有同样的错误。将 scalaVersion 增加到 2.11.6 解决了它。
我遇到了一个问题,无法解决。
今天,我在构建项目时遇到错误。主题中描述了此错误:
据我所知,新版本的 scala 已发布 (2.12.0-M1) 并且依赖关系已被破坏。 这个问题的答案是使用代码覆盖 "org.scala-lang" 和 "scala-compiler" 依赖项:
dependencyOverrides += "org.scala-lang" % "scala-compiler" % scalaVersion.value
我的 scalaVersion 是 scalaVersion := "2.11.1"
。
这解决了构建项目的问题。
服务器成功运行,但是当我尝试调用 DB
对象(扩展 Instance
)来执行查询时,我得到一个异常:
play.api.Application$$anon: Execution exception[[RuntimeException: java.lang.ExceptionInInitializerError]]
at play.api.Application$class.handleError(Application.scala:296) ~[play_2.11-2.3.7.jar:2.3.7]
at play.api.DefaultApplication.handleError(Application.scala:402) [play_2.11-2.3.7.jar:2.3.7]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$$anonfun$applyOrElse.apply(PlayDefaultUpstreamHandler.scala:320) [play_2.11-2.3.7.jar:2.3.7]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$$anonfun$applyOrElse.apply(PlayDefaultUpstreamHandler.scala:320) [play_2.11-2.3.7.jar:2.3.7]
at scala.Option.map(Option.scala:146) [scala-library-2.11.6.jar:na]
Caused by: java.lang.RuntimeException: java.lang.ExceptionInInitializerError
at play.api.mvc.ActionBuilder$$anon.apply(Action.scala:523) ~[play_2.11-2.3.7.jar:2.3.7]
at play.api.mvc.Action$$anonfun$apply$$anonfun$apply$$anonfun$apply.apply(Action.scala:130) ~[play_2.11-2.3.7.jar:2.3.7]
at play.api.mvc.Action$$anonfun$apply$$anonfun$apply$$anonfun$apply.apply(Action.scala:130) ~[play_2.11-2.3.7.jar:2.3.7]
at play.utils.Threads$.withContextClassLoader(Threads.scala:21) ~[play_2.11-2.3.7.jar:2.3.7]
at play.api.mvc.Action$$anonfun$apply$$anonfun$apply.apply(Action.scala:129) ~[play_2.11-2.3.7.jar:2.3.7]
Caused by: java.lang.ExceptionInInitializerError: null
at models.dao.UserDAO$.getUser(UserDAO.scala:32) ~[classes/:na]
at controllers.User$$anonfun$login.apply(User.scala:82) ~[classes/:na]
at controllers.User$$anonfun$login.apply(User.scala:80) ~[classes/:na]
at play.api.mvc.ActionBuilder$$anonfun$apply.apply(Action.scala:433) ~[play_2.11-2.3.7.jar:2.3.7]
at play.api.mvc.ActionBuilder$$anonfun$apply.apply(Action.scala:432) ~[play_2.11-2.3.7.jar:2.3.7]
Caused by: scala.tools.reflect.ToolBoxError: reflective compilation has failed: cannot initialize the compiler due to java.lang.VerifyError: scala/tools/reflect/ToolBoxFactory$ToolBoxImpl$ToolBoxGlobal
at scala.tools.reflect.ToolBoxFactory$ToolBoxImpl$withCompilerApi$api$.liftedTree1(ToolBoxFactory.scala:344) ~[scala-compiler-2.11.1.jar:na]
at scala.tools.reflect.ToolBoxFactory$ToolBoxImpl$withCompilerApi$api$.compiler$lzycompute(ToolBoxFactory.scala:330) ~[scala-compiler-2.11.1.jar:na]
at scala.tools.reflect.ToolBoxFactory$ToolBoxImpl$withCompilerApi$api$.compiler(ToolBoxFactory.scala:329) ~[scala-compiler-2.11.1.jar:na]
at scala.tools.reflect.ToolBoxFactory$ToolBoxImpl$withCompilerApi$.liftedTree2(ToolBoxFactory.scala:356) ~[scala-compiler-2.11.1.jar:na]
at scala.tools.reflect.ToolBoxFactory$ToolBoxImpl$withCompilerApi$.apply(ToolBoxFactory.scala:354) ~[scala-compiler-2.11.1.jar:na]
Caused by: java.lang.VerifyError: scala/tools/reflect/ToolBoxFactory$ToolBoxImpl$ToolBoxGlobal
at scala.tools.reflect.ToolBoxFactory$ToolBoxImpl$withCompilerApi$api$.liftedTree1(ToolBoxFactory.scala:334) ~[scala-compiler-2.11.1.jar:na]
at scala.tools.reflect.ToolBoxFactory$ToolBoxImpl$withCompilerApi$api$.compiler$lzycompute(ToolBoxFactory.scala:330) ~[scala-compiler-2.11.1.jar:na]
at scala.tools.reflect.ToolBoxFactory$ToolBoxImpl$withCompilerApi$api$.compiler(ToolBoxFactory.scala:329) ~[scala-compiler-2.11.1.jar:na]
at scala.tools.reflect.ToolBoxFactory$ToolBoxImpl$withCompilerApi$.liftedTree2(ToolBoxFactory.scala:356) ~[scala-compiler-2.11.1.jar:na]
at scala.tools.reflect.ToolBoxFactory$ToolBoxImpl$withCompilerApi$.apply(ToolBoxFactory.scala:354) ~[scala-compiler-2.11.1.jar:na]
我认为这与 scala 更新和配置问题有关,因为昨天我使用相同的服务,没有任何异常。
我的build.sbt
:
name := """XXXX"""
version := "1.0-SNAPSHOT"
lazy val root = (project in file(".")).enablePlugins(PlayScala)
scalaVersion := "2.11.1"
dependencyOverrides += "org.scala-lang" % "scala-compiler" % scalaVersion.value
libraryDependencies ++= Seq(
jdbc,
anorm,
cache,
ws,
"org.sorm-framework" % "sorm" % "0.3.18",
"com.typesafe.play" %% "play-mailer" % "2.4.0",
"com.typesafe.play" %% "play-json" % "2.3.7",
"postgresql" % "postgresql" % "9.1-901.jdbc4",
"com.sksamuel.scrimage" %% "scrimage-core" % "1.4.2",
"com.sksamuel.scrimage" %% "scrimage-canvas" % "1.4.2",
"com.sksamuel.scrimage" %% "scrimage-filters" % "1.4.2",
"com.notnoop.apns" % "apns" % "1.0.0.Beta6",
"org.scalatest" % "scalatest_2.11" % "2.2.4" % "test"
)
知道为什么会这样吗?
谢谢
我有同样的错误。将 scalaVersion 增加到 2.11.6 解决了它。