Reputation: 166
I'm working on a project, using Java Play-framework. Until now I always tested it by executing ./activator run
, which worked flawlessly. Now, I wanted to try and deploy it by running ./activator start
instead. This raises a compilation error though, and I don't know why because the code seems to be in order.
The error:
[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
The "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;
}
}
}
I need this because ./activator dist
throws the same error, and I need to be able to create a distributable version of the program.
Upvotes: 3
Views: 100
Reputation: 4463
public void Login(String usrnm, String psswrd){
username = usrnm;
password = psswrd;
}
This is not a constructor. Remove void
keyword. Keep in mind, not having a default constructor for a form will result in runtime exceptions.
Upvotes: 3