|
Replies:
1
-
Pages:
1
-
Last Post:
Dec 18, 2011 6:06 AM
by: Domingo
|
|
|
Posts:
7
Registered:
12/4/11
|
|
|
|
Chapter 5: Command objects under Grails 2.0.0-RC1
Posted:
Dec 4, 2011 4:51 AM
|
|
Hi,
I'm going through Grails in Action using Grails 2.0.0-RC1. It's rather smooth so far. The first obstacle that I noticed is a comman object (listing 5.13) that doesn't work. When pointing browser to register2 action I get:
URI /hubbub/user/register2 Class java.lang.IllegalArgumentException Message object is not an instance of declaring class
Line | Method ->> 101 | doCall in com.grailsinaction.UserRegistrationCommand$__clinit__closure1$$ENI6ld3w - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 26 | doFilter in DevModeSanityFilter.groovy | 1110 | runWorker in java.util.concurrent.ThreadPoolExecutor | 603 | run in java.util.concurrent.ThreadPoolExecutor$Worker ^ 722 | run . . . in java.lang.Thread
which, if I clearly interpret the message, means that binding doesn't work for register2 action in the controller:
def register2 = {UserRegistrationCommand urc -> if (urc.hasErrors()) { ... }
I tried with both closure and method as controller action (introduced in Grails 2) but the effect is the same. Any hints?
|
|
Posts:
7
Registered:
12/4/11
|
|
|
|
Re: Chapter 5: Command objects under Grails 2.0.0-RC1
Posted:
Dec 18, 2011 6:06 AM
in response to:
Domingo
|
|
Hi, I returned to this issue because in other places where Command objects were used, they worked perfectly for me. So after investigating my issue more deeply I found a typo in my Command object, i.e.:
class UserRegistrationCommand { ... String fullName ...
static constraints = { ... fullname(nullable: true) // should be fullName } }
Pity that the message was completely missleading.
|
|
|
Legend
|
|
Gold: 300
+
pts
|
|
Silver: 100
- 299
pts
|
|
Bronze: 25
- 99
pts
|
|
Manning Author
|
|
Manning Staff
|
|