使用Scala进行播放时出现意外异常

时间:2015-06-03 09:09:18

标签: scala playframework-2.0 sbt

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

中提到的错误相同

这是我在浏览器中获得的内容:

  

scala.MatchError:java.lang.StackOverflowError(类   java.lang.StackOverflowError的)        play.PlayReload $$ anonfun $ taskFailureHandler $ 1.适用(PlayReload.scala:44)        play.PlayReload $$ anonfun $ taskFailureHandler $ 1.适用(PlayReload.scala:44)        scala.Option.map(Option.scala:145)        play.PlayReload $ .taskFailureHandler(PlayReload.scala:44)        play.PlayReload $ .compileFailure(PlayReload.scala:40)        play.PlayReload $$ anonfun $编译$ 1.适用(PlayReload.scala:17)        play.PlayReload $$ anonfun $编译$ 1.适用(PlayReload.scala:17)        scala.util.Either $ LeftProjection.map(Either.scala:377)        play.PlayReload $ .compile(PlayReload.scala:17)

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

  

scala.tools.nsc.typechecker.Typers $ $ Typer.scala工具$ $ NSC $ typechecker $ Typers $$打字员typedInternal(Typers.scala:5332)     在scala.tools.nsc.typechecker.Typers $ Typer.body $ 2(Typers.scala:5279)     在scala.tools.nsc.typechecker.Typers $ Typer.typed(Typers.scala:5283)     在   scala.tools.nsc.typechecker.Typers $打字员$$ anonfun $ 93.apply(Typers.scala:4440)   [error](编译:编译)java.lang.StackOverflowError [错误]   申请 -

     

!内部服务器错误,对于(GET)[/] - >

     

scala.MatchError:java.lang.StackOverflowError(类   java.lang.StackOverflowError)at   play.PlayReload $$ anonfun $ taskFailureHandler $ 1.适用(PlayReload.scala:44)   〜[na:na] at   play.PlayReload $$ anonfun $ taskFailureHandler $ 1.适用(PlayReload.scala:44)   〜[na:na]在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链接更改其堆大小,但它也无法正常工作,我仍然遇到同样的错误。

这是我的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"
                    )

请指导我。

1 个答案:

答案 0 :(得分:1)

更改堆栈大小对我有用

我用这个命令来运行项目

  

激活器运行-J-Xss4M -server