类型安全激活器:"run" 有效,但 "start" 失败并出现错误
Typesafe Activator: "run" works, but "start" fails with an error
我正在做一个项目,使用 Java Play-framework。直到现在,我总是通过执行 ./activator run
来测试它,它工作得很好。现在,我想尝试通过 运行 ./activator start
来部署它。但这会引发编译错误,我不知道为什么,因为代码似乎是有序的。
错误:
[error] /home/ghijs/psopv/psopv-2015-groep13/Code/activator-CodeSubmission/app/helpers/Login.java:12: illegal cyclic reference involving method Login
[error] public class Login {
[error] ^
[error] one error found
[error] (compile:doc) Scaladoc generation failed
[error] Total time: 16 s, completed Jun 4, 2015 2:02:31 PM
"Login" class:
package helpers;
import models.User;
import play.Logger;
import play.data.Form;
import play.data.validation.Constraints.MinLength;
import play.data.validation.Constraints.Required;
public class Login {
@Required
@MinLength(4)
private String username;
@Required
@MinLength(5)
private String password;
private String userID;
private User.UserType userType;
public void Login(String usrnm, String psswrd){
username = usrnm;
password = psswrd;
}
public String getUsername() {return username;}
public String getPassword() {return password;}
public String getUserID() {return userID;}
public User.UserType getUserType() {return userType;}
public void setUsername(String u){username = u;}
public void setPassword(String p){password = p;}
public final static Form<Login> LOGIN_FORM = new Form(Login.class);
public String validate(){
Logger.info("Validating login info ...");
User u = User.authenticate(username, password);
if(u == null) {
Logger.error("Invalid username or password.");
return "Invalid user or password";
}
else {
Logger.info("Validating login info ... OK");
userID = u.getIdentifier();
userType = u.getUserType();
return null;
}
}
}
我需要这个,因为 ./activator dist
会抛出同样的错误,我需要能够创建该程序的可分发版本。
public void Login(String usrnm, String psswrd){
username = usrnm;
password = psswrd;
}
这不是构造函数。删除 void
关键字。请记住,没有表单的默认构造函数会导致运行时异常。
我正在做一个项目,使用 Java Play-framework。直到现在,我总是通过执行 ./activator run
来测试它,它工作得很好。现在,我想尝试通过 运行 ./activator start
来部署它。但这会引发编译错误,我不知道为什么,因为代码似乎是有序的。
错误:
[error] /home/ghijs/psopv/psopv-2015-groep13/Code/activator-CodeSubmission/app/helpers/Login.java:12: illegal cyclic reference involving method Login
[error] public class Login {
[error] ^
[error] one error found
[error] (compile:doc) Scaladoc generation failed
[error] Total time: 16 s, completed Jun 4, 2015 2:02:31 PM
"Login" class:
package helpers;
import models.User;
import play.Logger;
import play.data.Form;
import play.data.validation.Constraints.MinLength;
import play.data.validation.Constraints.Required;
public class Login {
@Required
@MinLength(4)
private String username;
@Required
@MinLength(5)
private String password;
private String userID;
private User.UserType userType;
public void Login(String usrnm, String psswrd){
username = usrnm;
password = psswrd;
}
public String getUsername() {return username;}
public String getPassword() {return password;}
public String getUserID() {return userID;}
public User.UserType getUserType() {return userType;}
public void setUsername(String u){username = u;}
public void setPassword(String p){password = p;}
public final static Form<Login> LOGIN_FORM = new Form(Login.class);
public String validate(){
Logger.info("Validating login info ...");
User u = User.authenticate(username, password);
if(u == null) {
Logger.error("Invalid username or password.");
return "Invalid user or password";
}
else {
Logger.info("Validating login info ... OK");
userID = u.getIdentifier();
userType = u.getUserType();
return null;
}
}
}
我需要这个,因为 ./activator dist
会抛出同样的错误,我需要能够创建该程序的可分发版本。
public void Login(String usrnm, String psswrd){
username = usrnm;
password = psswrd;
}
这不是构造函数。删除 void
关键字。请记住,没有表单的默认构造函数会导致运行时异常。