[英]Play framework + Ebean: [error] … not found: type Finder
我在Play 2.0中开发了一个Java应用程序,现在我正在尝试将其部署到AWS。 我首先尝试以与在本地计算机上相同的方式运行它。 我将播放源复制到虚拟EC2服务器(Ubuntu 12.04),导出播放到类路径,并复制我的项目。 当我运行play compile时,我收到以下错误
[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
该应用程序基于Ebean的CRUD示例构建。 当我尝试在Play中编译该示例应用程序时,我没有任何麻烦。 为什么编译器与Finder有问题?
这种情况偶尔会发生在我身上,有时会编译,有时则不会。
我通过将Finder
更改为更具体的Model.Finder
来修复它。
你的线路变成:
public static Model.Finder<Long,Dealership> find = new Model.Finder<Long,Dealership>(Long.class, Dealership.class);
我有同样的问题,编译结果取决于编译的订单文件。 我无法部署该应用程序。 我无法解释原因,但我解决了它在视图中删除finder的用法。
有一个例子,尝试在视图中替换:
index.scala.html
@for(dealer <- Dealership.find.all()) {
...
}
同
@(dealerships: List[Dealership])
...
@for(dealer <- dealerships) {
...
}
并添加到您的控制器:
public class Dealerships extends Controller {
public Result index() {
return ok (index.render (Dealership.find.all()));
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.