Marouane Lakhal
Marouane Lakhal

Reputation: 784

Play 2.0 unexpected exception StackOverflowError: null

When I try to compile my project I get the following exception:

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

play.api.UnexpectedException: Unexpected exception [StackOverflowError: null]
    at sbt.PlayReloader$$anon$2$$anonfun$reload$3$$anonfun$4$$anonfun$apply$12.apply(PlayReloader.scala:233) ~[na:na]
    at sbt.PlayReloader$$anon$2$$anonfun$reload$3$$anonfun$4$$anonfun$apply$12.apply(PlayReloader.scala:226) ~[na:na]
    at scala.Option.map(Option.scala:133) ~[scala-library.jar:0.11.3]
    at sbt.PlayReloader$$anon$2$$anonfun$reload$3$$anonfun$4.apply(PlayReloader.scala:226) ~[na:na]
    at sbt.PlayReloader$$anon$2$$anonfun$reload$3$$anonfun$4.apply(PlayReloader.scala:224) ~[na:na]
    at scala.Either$LeftProjection.map(Either.scala:183) ~[scala-library.jar:0.11.3]
java.lang.StackOverflowError: null
    at scala.tools.nsc.transform.Erasure$Eraser.typed1(Erasure.scala:731) ~[scala-compiler.jar:na]
    at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4271) ~[scala-compiler.jar:na]
    at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:4138) ~[scala-compiler.jar:na]
    at scala.tools.nsc.transform.Erasure$Eraser.typed1(Erasure.scala:731) ~[scala-compiler.jar:na]
    at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4271) ~[scala-compiler.jar:na]
    at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$typedApply$1$1.apply(Typers.scala:3353) ~[scala-compiler.jar:na]

I found the same issue in the Play 2 issue tracker and they said that when the routes file grows it makes that exception.

Is there a solution to this exception because my project doesn't compile anymore ?

I'm using Play 2.0.3 for scala(my routes file is about 150 line)

Upvotes: 4

Views: 1332

Answers (2)

phidias
phidias

Reputation: 518

I had the same issue with Play 2.0.6. Upgraded to Play 2.0.8 and it didn't help. I then modified the $play_dir/framework/build script so it builds with -Xss2M instead of -Xss1M and the problem disappeared (I can compile normally now).

Upvotes: 2

Alex
Alex

Reputation: 1470

There is a bug with play 2.0 having to do with the size of the routes file, not in terms of the number of routes but rather the physical size of the file (32768 bytes). It seems that this cieling has increased for 2.0.4 and is eliminated with 2.1.

https://groups.google.com/forum/?fromgroups=#!topic/play-framework/fZvgWJoCPLc

So, first, I would take a look at the physical size of the routes file. It may be possible cut out comments and/or eliminate commented-out lines. Next, I would try upgrading to version 2.0.4. That is a fairly easy process. You just need to download 2.0.4, point play to this new path, and update the /project/plugins.sbt of the project to read:

// Use the Play sbt plugin for Play projects
addSbtPlugin("play" % "sbt-plugin" % "2.0.4")

A more long-term fix may be to upgrade your project to 2.1 once it becomes stable.

Upvotes: 0

Related Questions