Note that there are some explanatory texts on larger screens.

plurals
  1. POPlayframework: [RuntimeException: java.lang.reflect.InvocationTargetException]
    primarykey
    data
    text
    <p>I'm trying to create a simple login based on the Zentask sample --<a href="http://www.playframework.com/documentation/2.2.x/JavaGuide4" rel="nofollow noreferrer">zentask - playframework</a>, however when I click the login button which calls the Application.authenticate actions, it gives runtime exception. I have marked the line with -- error</p> <pre><code>[RuntimeException: java.lang.reflect.InvocationTargetException] </code></pre> <p>Application.java</p> <pre><code>public class Application extends Controller { ......... public static class Login { public String email; public String password; public String validate() { if (User.authenticate(email, password) == null) { return "Invalid user or password"; } return null; } } public static Result authenticate() { Form&lt;Login&gt; loginForm = form(Login.class).bindFromRequest(); //--- error if(loginForm.hasErrors()) { return badRequest(login.render(loginForm)); } else { session("email", loginForm.get().email); return redirect( routes.Application.index() ); } } } </code></pre> <p>I understand it has something to do with the validate function in Login Class, because when I remove the call to User.authenticate in the validate function it works without error. But I am unable to figure it out.</p> <p>The user class is as - </p> <pre><code>@Entity public class User extends Model { @Id @Constraints.Required @Formats.NonEmpty public String userId; @OneToOne(cascade=CascadeType.PERSIST) AccountDetails accDetails; public static Model.Finder&lt;String,User&gt; find = new Model.Finder&lt;String,User&gt;(String.class, User.class); // Authenticate the user details public static User authenticate(String email, String password) { String tempId = AccountDetails.authenticate(email, password).userId; return find.ref(tempId); } .. . . . . . . } </code></pre> <p>and the AccountDetails Class - </p> <pre><code>@Entity public class AccountDetails extends Model { @Id String userId; @Constraints.Required String emailId; @Constraints.Required String password; public static Model.Finder&lt;String,AccountDetails&gt; find = new Model.Finder&lt;String,AccountDetails&gt;(String.class, AccountDetails.class); public static AccountDetails authenticate(String email, String password) { return find.where() .eq("email", email) .eq("password", password) .findUnique(); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload