Sunday, April 28, 2013

[Resolved] Could not create a new instance of class [HibernateGrailsPlugin]!

After I upgraded my Grails app from 1.3.7 to 2.1.0, I can compile it, run app in development mode successfully, But failed to deploy it in tomcat.

I get the following error when I put war file in tomcat and start it:

Could not create a new instance of class [HibernateGrailsPlugin]!
........
Caused by: groovy.lang.MissingPropertyException: No such property: onChange for class: org.codehaus.groovy.grails.plugins.orm.hibernate.H ibernatePluginSupport


I was struggling with this issue for almost two days, and finally resolve it.

In Grails 1.3.7, org.codehaus.groovy.grails.plugins.orm.hibernate.H ibernatePluginSupport is included in grails-gorm plugin, and you can find that the latest version of gorm package is 1.3.7.

There is no any newer version for this plugin, because in later version of Grails, this class is not included in grails-gorm.jar, but in grails-hibernate-2.x.jar.

So the solution cloud be very simple, I should find the problem maker (grails-gorm 1.3.7 jar) and remove it in my dependency. 

I find that in my app, the other engineers (who created this project one year ago) use both maven and grails to manage dependencies and build project, and there is dependency entry for gorm 1.3.7 in pom file. Then, life is easy, just clean up pom file and recompile it. 


DONE!

Please do not use both maven and grails to manage dependencies and build project in the same time.

No comments:

Post a Comment