[info] play - database [default] connected at jdbc:h2:mem:play
[info] play - Application started (Dev)
null
null
Form<Login>: Form(of=class controllers.Application$Login, data={email=mye...@address.com, password=mySecredPwd}, value=Some(Login [email=null, password=null]), errors={})
Login: Login [email=null, password=null]
[IllegalStateException: No value]In ...\projects\sample\target\scala-2.9.1\src_managed\main\routes_routing.scala at line 60.
// @LINE:10
case controllers_Application_authenticate2(params) => {
call {
invokeHandler(_root_.controllers.Application.authenticate(), HandlerDef(this, "controllers.Application", "authenticate", Nil))
}
}
[error] application -
! @6a9g04l6b - Internal server error, for request [POST /login] ->
play.core.ActionInvoker$$anonfun$receive$1$$anon$1: Execution exception [[IllegalStateException: No value]]
at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:134) [play_2.9.1.jar:2.0.1]
at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:115) [play_2.9.1.jar:2.0.1]
at akka.actor.Actor$class.apply(Actor.scala:311) [akka-actor.jar:2.0.1]
at play.core.ActionInvoker.apply(Invoker.scala:113) [play_2.9.1.jar:2.0.1]
at akka.actor.ActorCell.invoke(ActorCell.scala:619) [akka-actor.jar:2.0.1]
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:196) [akka-actor.jar:2.0.1]
Caused by: java.lang.IllegalStateException: No value
at play.libs.F$None.get(F.java:217) ~[play_2.9.1.jar:2.0.1]
at play.data.Form.get(Form.java:361) ~[play_2.9.1.jar:2.0.1]
at controllers.Application.authenticate(Application.java:49) ~[classes/:2.0.1]
at Routes$$anonfun$routes$1$$anonfun$apply$5$$anonfun$apply$6.apply(routes_routing.scala:60) ~[classes/:na]
at Routes$$anonfun$routes$1$$anonfun$apply$5$$anonfun$apply$6.apply(routes_routing.scala:60) ~[classes/:na]
at play.core.Router$HandlerInvoker$$anon$4$$anon$1.invocation(Router.scala:1086) ~[play_2.9.1.jar:2.0.1]
My application.conf: http://pastebin.com/J7pt4uisMy routes: http://pastebin.com/fBVbYWMSSo basically standard config.Last night I discovered something strange. I cloned an earlier revision from my GIT repo, and it worked fine. Then I did some work on this version, but at some point this problem occured again. I then comitted (and pushed) the changes into the repo, and cloned it into a third directory. Now it worked again.I also seem to have some issues with the changes in the scala templates being discovered by the java classes. If I modify the method signature of a template,then I often have to rename the template name (and back again, eg. home.scala.html -> homeNew.scala.html -> home.scala.html) for the API to be updated. I an using the latest version of Eclipse, and have enabled that the IDE should automatically update/refresh changed files (why this is not on by default is a mystery for me).I have not verified that building from scratch (as when cloning my GIT repo) works all the time, but my immediate suspicion is that something is wrong with the generated classes. Are there any settings that could affect this...? OS (windows 7), encoding (UTF-8) etc...?
The following code snippet descibes my problems with my first Play 2.0 application. I simply cannot manage to bind data from a form POST to the associated class. Form.data contains the values, but when I invoke bindFromRequest, the entity/bean is populated with null-values.
My controller class: http://pastebin.com/fmdfR4J8
My template: http://pastebin.com/k6jXTHvP
(these are nearly identical to the examples provided by Play (Zentasks).
I have even done this twice now, from a fresh app (in case there were other aspects that disturbed this process).
When i open this template and posts a username and a password to the controller, the System.out.println() debugs gives the following output:
[info] play - database [default] connected at jdbc:h2:mem:play
[info] play - Application started (Dev)
null
null
Form<Login>: Form(of=class controllers.Application$Login, data={email=myemail@address.com, password=mySecredPwd}, value=Some(Login [email=null, password=null]), errors={})
Hi!I had the same problem, it took me a while to unfold it. I guess I found the cause.For every class being "filled" with bindFromRequest() Play! will try to invoke from that class a method called validate. It's a second validation step after performing the regular play.data.validation package validations.If your class validate method returns a value different from null, bindFromRequest() will return a Form object with a None object on the value field.A None object will throw an IllegalStateException("No value") when it's method get is called.You should avoid having a method validate from classes you are retrieving from a Form, unless you know what you are doing.
--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framewor...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
[CompletionException: java.lang.IllegalStateException: Error(s) binding form: {"password":["This field is required"],"confirmPassword":["This field is required"],"email":["This field is required"]}]