I have been running into a few problems with compiling my play framework application. Sometimes the application runs fine but most of the time these problems both occur with the sbt and activator tools. Here is an example of compiling my application with sbt:
[info] Compiling 15 Scala sources and 1 Java source to C:\Server\trunk\target\scala-2.11\classes...
[error] C:\Server\trunk\target\scala-2.11\src_managed\main\controllers\routes.java:8: error: cannot find symbol
[error] public static final controllers.ReverseAssets Assets = new controllers.ReverseAssets();
[error] ^
[error] symbol: class ReverseAssets
[error] location: package controllers
[error] C:\Server\trunk\target\scala-2.11\src_managed\main\controllers\routes.java:9: error: cannot find symbol
[error] public static final controllers.ReverseApplication Application = new controllers.ReverseApplication();
[error] ^
[error] symbol: class ReverseApplication
[error] location: package controllers
[error] C:\Server\trunk\target\scala-2.11\src_managed\main\controllers\routes.java:12: error: package controllers.javascript does not exist
[error] public static final controllers.javascript.ReverseAssets Assets = new controllers.javascript.ReverseAssets();
[error] ^
[error] C:\Server\trunk\target\scala-2.11\src_managed\main\controllers\routes.java:13: error: package controllers.javascript does not exist
[error] public static final controllers.javascript.ReverseApplication Application = new controllers.javascript.ReverseApplication();
[error] ^
[error] C:\Server\trunk\target\scala-2.11\src_managed\main\controllers\routes.java:18: error: package controllers.ref does not exist
[error] public static final controllers.ref.ReverseAssets Assets = new controllers.ref.ReverseAssets();
[error] ^
[error] C:\Server\trunk\target\scala-2.11\src_managed\main\controllers\routes.java:19: error: package controllers.ref does not exist
[error] public static final controllers.ref.ReverseApplication Application = new controllers.ref.ReverseApplication();
[error] ^
[error] C:\Server\trunk\target\scala-2.11\src_managed\main\controllers\routes.java:8: error: cannot find symbol
[error] public static final controllers.ReverseAssets Assets = new controllers.ReverseAssets();
[error] ^
[error] symbol: class ReverseAssets
[error] location: package controllers
[error] C:\Server\trunk\target\scala-2.11\src_managed\main\controllers\routes.java:9: error: cannot find symbol
[error] public static final controllers.ReverseApplication Application = new controllers.ReverseApplication();
[error] ^
[error] symbol: class ReverseApplication
[error] location: package controllers
[error] C:\Server\trunk\target\scala-2.11\src_managed\main\controllers\routes.java:12: error: package controllers.javascript does not exist
[error] public static final controllers.javascript.ReverseAssets Assets = new controllers.javascript.ReverseAssets();
[error] ^
[error] C:\Server\trunk\target\scala-2.11\src_managed\main\controllers\routes.java:13: error: package controllers.javascript does not exist
[error] public static final controllers.javascript.ReverseApplication Application = new controllers.javascript.ReverseApplication();
[error] ^
[error] C:\Server\trunk\target\scala-2.11\src_managed\main\controllers\routes.java:18: error: package controllers.ref does not exist
[error] public static final controllers.ref.ReverseAssets Assets = new controllers.ref.ReverseAssets();
[error] ^
[error] C:\Server\trunk\target\scala-2.11\src_managed\main\controllers\routes.java:19: error: package controllers.ref does not exist
[error] public static final controllers.ref.ReverseApplication Application = new controllers.ref.ReverseApplication();
[error] ^
[error] 12 errors
[error] (compile:compile) javac returned nonzero exit code
[error] Total time: 16 s, completed Oct 31, 2014 11:18:25 AM
Other times I'll get this error with sbt clean compile:
[info] Compiling 15 Scala sources and 1 Java source to C:\Server\trunk\target\scala-2.11\classes...
[trace] Stack trace suppressed: run last compile:compile for the full output.
[error] (compile:compile) java.lang.NoClassDefFoundError: Lcontrollers/ReverseAssets;
[error] Total time: 45 s, completed Oct 31, 2014 11:45:49 AM
Then I'll exit out of sbt then run sbt clean compile again and everything seems to compile fine. I'll even run activator run and everything compiles fine but none of the routes are recognized:
# Home page
GET / controllers.Application.index
GET /login controllers.Application.login
And then I'll get errors compiling with activator run:
[info] Compiling 15 Scala sources and 1 Java source to C:\Server\trunk\target\scala-2.11\classes...
[error] C:\Server\trunk\target\scala-2.11\src_managed\main\controllers\routes.java:13: error: cannot find symbol
[error] public static final controllers.javascript.ReverseApplication Application = new controllers.javascript.ReverseApplication()
[error] ^
[error] symbol: class ReverseApplication
[error] location: package controllers.javascript
[error] C:\Server\trunk\target\scala-2.11\src_managed\main\controllers\routes.java:13: error: cannot find symbol
[error] public static final controllers.javascript.ReverseApplication Application = new controllers.javascript.ReverseApplication()
[error] ^
[error] symbol: class ReverseApplication
[error] location: package controllers.javascript
[error] 2 errors
[error] (compile:compile) javac returned nonzero exit code
[error] application -
! @6k3l8fool - Internal server error, for (GET) [/] ->
play.PlayExceptions$CompilationException: Compilation error[error: cannot find symbol]
at play.PlayExceptions$CompilationException$.apply(PlayExceptions.scala:27) ~[na:na]
at play.PlayExceptions$CompilationException$.apply(PlayExceptions.scala:27) ~[na:na]
at scala.Option.map(Option.scala:145) ~[scala-library-2.11.1.jar:na]
at play.PlayReloader$$anon$1$$anonfun$play$PlayReloader$$anon$$taskFailureHandler$1.apply(PlayReloader.scala:235) ~[na:na]
at play.PlayReloader$$anon$1$$anonfun$play$PlayReloader$$anon$$taskFailureHandler$1.apply(PlayReloader.scala:230) ~[na:na]
[warn] play - No application found at invoker init
Then I run activator clean run and I get a completely different error:
[info] Compiling 15 Scala sources and 1 Java source to C:\Server\trunk\target\scala-2.11\classes...
java.lang.IllegalArgumentException: requirement failed: Source file 'C:\Server\trunk\target\scala-2.11\classes\Routes$$anonfun$routes$1$$anonfun$applyOrElse$4.class' does not exist.
at scala.Predef$.require(Predef.scala:233)
at sbt.IO$.copyFile(IO.scala:580)
at sbt.IO$.sbt$IO$$copyImpl(IO.scala:559)
at sbt.IO$$anonfun$copy$1.apply(IO.scala:548)
at sbt.IO$$anonfun$copy$1.apply(IO.scala:548)
at scala.Function$$anonfun$tupled$1.apply(Function.scala:77)
at scala.Function$$anonfun$tupled$1.apply(Function.scala:76)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)
at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:47)
at scala.collection.TraversableLike$class.map(TraversableLike.scala:244)
at scala.collection.AbstractTraversable.map(Traversable.scala:105)
at sbt.IO$.copy(IO.scala:548)
at play.PlayCommands$$anonfun$PostCompile$1.apply(PlayCommands.scala:162)
at play.PlayCommands$$anonfun$PostCompile$1.apply(PlayCommands.scala:76)
at scala.Function8$$anonfun$tupled$1.apply(Function8.scala:35)
at scala.Function8$$anonfun$tupled$1.apply(Function8.scala:34)
at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:42)
at sbt.std.Transform$$anon$4.work(System.scala:64)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
at sbt.Execute.work(Execute.scala:244)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:160)
at sbt.CompletionService$$anon$2.call(CompletionService.scala:30)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:744)
[error] (compile:compile) java.lang.IllegalArgumentException: requirement failed: Source file 'C:\Server\AuthWebManager\trunk\target\scala-2.11\classes\Routes$$anonfun$routes$1$$anonfun$applyOrElse$4.
class' does not exist.
[error] application -
! @6k3l90dc5 - Internal server error, for (GET) [/] ->
play.PlayExceptions$UnexpectedException: Unexpected exception[IllegalArgumentException: requirement failed: Source file 'C:\Server\AuthWebManager\trunk\target\scala-2.11\classes\Routes$$anonfun$routes
$1$$anonfun$applyOrElse$4.class' does not exist.]
at play.PlayReloader$$anon$1$$anonfun$play$PlayReloader$$anon$$taskFailureHandler$1.apply(PlayReloader.scala:237) ~[na:na]
at play.PlayReloader$$anon$1$$anonfun$play$PlayReloader$$anon$$taskFailureHandler$1.apply(PlayReloader.scala:230) ~[na:na]
at scala.Option.map(Option.scala:145) ~[scala-library-2.11.1.jar:na]
at play.PlayReloader$$anon$1.play$PlayReloader$$anon$$taskFailureHandler(PlayReloader.scala:230) ~[na:na]
at play.PlayReloader$$anon$1$$anonfun$reload$2.apply(PlayReloader.scala:90) ~[na:na]
Caused by: java.lang.IllegalArgumentException: requirement failed: Source file 'C:\Server\trunk\target\scala-2.11\classes\Routes$$anonfun$routes$1$$anonfun$applyOrElse$4.class' does not
exist.
at scala.Predef$.require(Predef.scala:233) ~[scala-library-2.11.1.jar:na]
at sbt.IO$.copyFile(IO.scala:580) ~[na:na]
at sbt.IO$.sbt$IO$$copyImpl(IO.scala:559) ~[na:na]
at sbt.IO$$anonfun$copy$1.apply(IO.scala:548) ~[na:na]
at sbt.IO$$anonfun$copy$1.apply(IO.scala:548) ~[na:na]
[warn] play - No application found at invoker init
I've gotten a few different errors as well, but for conciseness sake I won't write them here. I've tried suggestions of deleting the .sbt and .ivy2/cache folders, but that hasn't solved the problem.
So what do I do so that my play application compiles and runs without seemingly non deterministic errors?
Delete "target" folder and run again, that worked for me:) !
For References: https://groups.google.com/forum/#!topic/play-framework/915-PGT8Zgs
I've run in similar random errors before. I've narrowed it down to an heavy memory usage because the exact same code will compile fine on the remote development server we use for pre-testing debug, also it will compile just fine and without random errors if I close the open apps in order to keep enough free memory for the compiler to do it's job.
I ran into similar issues. I am using eclipse with activator. Looks like problem was with eclipse when it tries to build app in the same director as play. I disabled "Build Automatically" setting from eclipse and so far its working fine. Have a look at this thread:
https://groups.google.com/forum/#!topic/play-framework/4RnbqEk-muM