If you’re having troubles with the Bean-Fields plugin on Grails 2.0.0.M2, there’s a quick workaround to get up and running. So if you see something like…
Caused by GrailsTagException: Error executing tag <bean:form>: Cannot get property 'class' on null object
You know you’ve tripped the issue.
I’ve logged the issue in GPBEANFIELDS-40 but the root cause is actually not beanfields at all. It’s a breaking change introduced in Grails 2.0.0-M2 for performance improvements (GRAILS-8001). The change has since been made backward compatible for RC1, so the break only occurs on 2.0.0-M2.
Line 922 of BeanFieldsTagLib needs a mod… Comment it out and replace with the mod below
//attrs._BEAN.bean = attrs.remove('bean') ?: pageScope.variables[attrs._BEAN.beanName] attrs._BEAN.bean = attrs.remove('bean') ?: pageScope.getVariable(attrs._BEAN.beanName)
And you’re in business!
Remember, this ONLY applies to 2.0.0-M2, all will be well in RC1!
Enjoy those DRY forms… And go buy Marc Palmer a nice wine next time you’re in the UK. I plan on it.