Play with Scala 中的意外异常

Unexpected exception in Play with Scala

我在使用 Scala 的 Play2 应用程序中遇到意外异常。与问题

中提到的相同错误

这是我在浏览器中得到的:

scala.MatchError: java.lang.WhosebugError (of class java.lang.WhosebugError) play.PlayReload$$anonfun$taskFailureHandler.apply(PlayReload.scala:44) play.PlayReload$$anonfun$taskFailureHandler.apply(PlayReload.scala:44) scala.Option.map(Option.scala:145) play.PlayReload$.taskFailureHandler(PlayReload.scala:44) play.PlayReload$.compileFailure(PlayReload.scala:40) play.PlayReload$$anonfun$compile.apply(PlayReload.scala:17) play.PlayReload$$anonfun$compile.apply(PlayReload.scala:17) scala.util.Either$LeftProjection.map(Either.scala:377) play.PlayReload$.compile(PlayReload.scala:17)

我的堆栈跟踪非常大。其中一部分如下所示:

scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedInternal(Typers.scala:5332) at scala.tools.nsc.typechecker.Typers$Typer.body(Typers.scala:5279) at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5283) at scala.tools.nsc.typechecker.Typers$Typer$$anonfun.apply(Typers.scala:4440) [error] (compile:compile) java.lang.WhosebugError [error] application -

! Internal server error, for (GET) [/] ->

scala.MatchError: java.lang.WhosebugError (of class java.lang.WhosebugError) at play.PlayReload$$anonfun$taskFailureHandler.apply(PlayReload.scala:44) ~[na:na] at play.PlayReload$$anonfun$taskFailureHandler.apply(PlayReload.scala:44) ~[na:na] at scala.Option.map(Option.scala:145) ~[scala-library-2.11.5.jar:na] at play.PlayReload$.taskFailureHandler(PlayReload.scala:44) ~[na:na] at play.PlayReload$.compileFailure(PlayReload.scala:40) ~[na:na]

我已经尝试了更改堆和堆栈大小的答案,但是当我 运行 jconsole 时它显示它不起作用。

我也尝试将其堆大小从 this link 更改,但它也没有用,我仍然遇到同样的错误。

这是我的 build.sbt 文件:

 name := """myproject"""

    version := "1.0-SNAPSHOT"

    lazy val root = (project in file(".")).enablePlugins(PlayScala)

    scalaVersion := "2.11.1"

    fork in run := true

    javaOptions in run ++= Seq(
        "-Xms1G", "-Xmx2G", "-XX:MaxPermSize=1024M", "-XX:+UseConcMarkSweepGC")

    //SBT_OPTS=-Xss8m

    //JAVA_OPTS="-Xms512m "

    //val buildSettings = Defaults.defaultSettings ++ Seq( javaOptions += "-Xms1G -Xmx2G"
    //)

    libraryDependencies ++= Seq("org.scalatest" %% "scalatest" % "2.2.1" % "test"withSources() withJavadoc(),
                        "com.esotericsoftware.kryo" % "kryo" % "2.10",
                    "org.mongodb" %% "casbah" % "2.8.0",
                    "org.slf4j" % "slf4j-api" % "1.6.4",
                    "org.elasticsearch" % "elasticsearch" % "1.5.0",
                    "org.scalatest" %% "scalatest" % "2.2.1" % "test"withSources() withJavadoc(),
                    "org.easymock" % "easymock" % "3.1" withSources() withJavadoc(),
                    "org.mockito" % "mockito-all" % "1.9.5",
                    "com.typesafe.akka" %% "akka-actor" % "2.3.6",
                    "ch.qos.logback" % "logback-core" % "1.0.9",
                    "ch.qos.logback" % "logback-classic" % "1.0.9"
                    )

请指导我。

更改堆栈大小对我有用

我使用此命令运行 项目

activator run -J-Xss4M -server