Nasty GORM / Grails 1.0.3 bug

So long since my last post … But finally here I come again with a new post related to a Grails bug and a quick workaround.

I previously saw on the web some other blogs commenting about a GORM dynamic method loading issue (here and here). However, this issue seems to be related to the 1.1.1 revision of Grails and I didn’t consider it a lot since I’m still running 1.0.3 … Found today a quite similar issue into 1.0.3 release but occuring on static methods you may have defined yourself (and not dynamically injected into class by GORM).

The symptom

It may produce some awful errors like this one :

MissingMethodException: No signature of method: static is applicable ...

happening on static method defined in the domain class itself. See for example the link method of the Membership class in this Grails sample.

The workaround

As stated in Peter Delahunty blog the ‘loading on Bootstap’ trick seems to work well for that issue too. As this problem was only raised during my integration tests, I’ve also succeed in making an extra call to the count method before the first invocation of link method onto the Membership class.

Something like :

assertEquals(0, Membership.count())
def m =, team) // Works now - was previously failing !

Happy coding !


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s