play framework 2.0 - unexpected exception - Key No

2020-08-11 04:59发布

问题:

I'm getting a key not found error message while trying to start my Play 2.0 app. I actually think that I did not change anything, and this error just popped-up. Actually I did one thing. I opened the files in the folder target/scala-2.9.1/src_managed/main and closed it (I did not changed anything, nor saved or deleted a file). But after reloading the app I got this error. Any idea what I can do?

[info] play - Listening for HTTP on port 9000...

(Server started, use Ctrl+D to stop and go back to the console...)

[error] {file:/Volumes/INPROG/03_Projects/06_Play_Applications/Space-for-Art/}Space-for-Art/compile:sources: java.util.NoSuchElementException: key not found: SOURCE [error] application -

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

play.api.UnexpectedException: Unexpected exception [NoSuchElementException: key not found: SOURCE] at sbt.PlayReloader$$anon$2$$anonfun$reload$3$$anonfun$2$$anonfun$apply$11.apply(PlayReloader.scala:228) ~[na:na] at sbt.PlayReloader$$anon$2$$anonfun$reload$3$$anonfun$2$$anonfun$apply$11.apply(PlayReloader.scala:221) ~[na:na] at scala.Option.map(Option.scala:133) ~[scala-library.jar:0.11.2] at sbt.PlayReloader$$anon$2$$anonfun$reload$3$$anonfun$2.apply(PlayReloader.scala:221) ~[na:na] at sbt.PlayReloader$$anon$2$$anonfun$reload$3$$anonfun$2.apply(PlayReloader.scala:219) ~[na:na] at scala.Either$LeftProjection.map(Either.scala:183) ~[scala-library.jar:0.11.2] java.util.NoSuchElementException: key not found: SOURCE at scala.collection.MapLike$class.default(MapLike.scala:224) ~[scala-library.jar:0.11.2] at scala.collection.immutable.Map$EmptyMap$.default(Map.scala:87) ~[scala-library.jar:0.11.2] at scala.collection.MapLike$class.apply(MapLike.scala:135) ~[scala-library.jar:0.11.2] at scala.collection.immutable.Map$EmptyMap$.apply(Map.scala:87) ~[scala-library.jar:0.11.2] at play.templates.GeneratedSource.source(ScalaTemplates.scala:145) ~[templates_2.9.1.jar:2.0] at play.templates.GeneratedSource.sync(ScalaTemplates.scala:154) ~[templates_2.9.1.jar:2.0]

回答1:

Execute

play clean update

to refresh the compiled files. And then run:

play run

That should solve it