I'm developing a web service using Play Framework. My next step is to log in using module secure. However, Im getting a nullpointer exception as the following:
play.exceptions.JavaExecutionException
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:227)
at Invocation.HTTP Request(Play!)
Caused by: java.lang.NullPointerException
at play.utils.Java.invokeStaticOrParent(Java.java:146)
at controllers.Secure$Security.invoke(Secure.java:193)
at controllers.Secure$Security.access$0(Secure.java:184)
at controllers.Secure.authenticate(Secure.java:61)
at play.mvc.ActionInvoker.invokeWithContinuation(ActionInvoker.java:540)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:498)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:474)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:469)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:157)
... 1 more
According to Playframework Secure module: how do you "log in" to test a secured controller in a FunctionalTest? it's possible to do a post to /login, which I also have tested and it works perfectly in a test-case.
To recreate nullpointer exception do the following:
- List item
- Create a new project
- Add the module secure as a dependency
- install the dependencies 'play dependencies'
- Restart web app.
- Send a post to /login. I have added two request headers (username and password), but the exception occurs both with and without any headers. The post is (in my case) sent using REST Client for Firefox.
Thankful for any help!