I'm having this problem in Grails 1.2 (Snapshot >M3), but its in my own code, not the sample code.
With:
parentClass.myClass.properties = params.myClassProps
I get:
ERROR [03 Nov - 18:10:42,236] web.errors.GrailsExceptionResolver - Cannot set readonly property: properties for class: MyClass_$$_javassist_29
groovy.lang.ReadOnlyPropertyException: Cannot set readonly property: properties for class: MyClass_$$_javassist_29
I do similar stuff elsewhere in code and it seems to work ok though, so I'm not sure of the particulars.
I found a workaround for my case where I eagerly fetch the myClass with the parentClass:
def parentClass = ParentClass.findById(params.parentId, [fetch:[myClass:'eager']])
parentClass.myClass.properties = params.myClassProps
Don't know whether this will help with yours though.
Cheers,
Chris.
jdl wrote:
The Definitive Guide to Grails, 2nd ed. is just what we were looking for since it covers using java classes and interfaces in a grails app.
I've downloaded the latest version of the bookmarks project from svn. However, when I try to register a user from
http://localhost:8080/bookmarks/user/register, I get this error:
Error 500: groovy.lang.ReadOnlyPropertyException: Cannot set readonly property: properties for class: org.grails.bookmarks.User
Servlet: grails
URI: /bookmarks/grails/user/handleRegistration.dispatch
Exception Message: Cannot set readonly property: properties for class: org.grails.bookmarks.User
Caused by: groovy.lang.ReadOnlyPropertyException: Cannot set readonly property: properties for class: org.grails.bookmarks.User
Class: UserController
At Line: [25]
Code Snippet:
24: else {
25: user.properties = params
26: if(user.save()) {
I'm new to grails and this error isn't one that I've run into yet. I'm using grails 1.1.1 with mysql and jdk 1.6.
Jade