문제

I developed a java application in Play 2.0 and now I am trying to deploy it to AWS. I am first trying to run it the same way as I did on my local computer. I copied the play sources to the virtual EC2 server (Ubuntu 12.04), exported play to classpath, and copied my project. When I run play compile, I get the following error

[info] Loading project definition from /home/ubuntu/play-2.0/samples/java/test-crud/project
[info] Set current project to computer-database (in build file:/home/ubuntu/play-2.0/samples/java/test-crud/)
[info] Updating {file:/home/ubuntu/play-2.0/samples/java/test-crud/}computer-database...
[info] Done updating.                                                                  
[info] Compiling 21 Scala sources and 16 Java sources to /home/ubuntu/play-2.0/samples  /java/test-crud/target/scala-2.9.1/classes...
[error] /home/ubuntu/play-2.0/samples/java/test-crud/app/models/Dealership.java:32: not found: type Finder
[error]     public static Finder<Long,Dealership> find = new Finder<Long,Dealership>(Long.class, Dealership.class); 
[error]                   ^
[error] one error found
[error] {file:/home/ubuntu/play-2.0/samples/java/test-crud/}computer-database/compile:compile: Compilation failed
[error] Total time: 117 s, completed Apr 21, 2014 3:48:33 AM

The application is built on the CRUD example with Ebean. When I try to compile that sample application in Play, I do not have any troubles. Why does the compiler have issues with Finder?

도움이 되었습니까?

해결책

This has been happening to me sporadically, some times it compiles, sometimes not.

I fixed it by changing Finder to the more specific Model.Finder.

Your line becomes:

public static Model.Finder<Long,Dealership> find = new Model.Finder<Long,Dealership>(Long.class, Dealership.class);

다른 팁

I had the same issue, the compilation result was depending on order files were compiled. And I could not deploy the application. I can't explain why, but I solve it removing the use of finder in views.

There is an example of what to do, try to replace in view :

index.scala.html

@for(dealer <- Dealership.find.all()) {
  ...
}

with

@(dealerships: List[Dealership])
...
@for(dealer <- dealerships) {
...
}

and add in your controller :

public class Dealerships extends Controller {
  public Result index() {
     return ok (index.render (Dealership.find.all()));
  }
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top