1
votes

I am having an Unexpected exception in my Play2 application with Scala. The same error as mentioned in this question

This is what I get in a browser:

scala.MatchError: java.lang.StackOverflowError (of class java.lang.StackOverflowError) play.PlayReload$$anonfun$taskFailureHandler$1.apply(PlayReload.scala:44) play.PlayReload$$anonfun$taskFailureHandler$1.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$1.apply(PlayReload.scala:17) play.PlayReload$$anonfun$compile$1.apply(PlayReload.scala:17) scala.util.Either$LeftProjection.map(Either.scala:377) play.PlayReload$.compile(PlayReload.scala:17)

My stack traces are very large. A part of them looks as follows:

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

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

scala.MatchError: java.lang.StackOverflowError (of class java.lang.StackOverflowError) at play.PlayReload$$anonfun$taskFailureHandler$1.apply(PlayReload.scala:44) ~[na:na] at play.PlayReload$$anonfun$taskFailureHandler$1.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]

I have tried the answers to change the heap and stack size but when I run jconsole it showed that it did not work.

I also tried to change its heap size from this link but it also did not work and I am still getting the same error.

Here is my build.sbt file :

 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"
                    )

Please guide me.

1
add the exact error and stacktrace..Sambhav Sharma

1 Answers

1
votes

Changing the stack size worked for me

I used this command to run the project

activator run -J-Xss4M -server