`

Cannot create an instance from the abstract interface 'groovy.lang.Category'

    博客分类:
  • Java
阅读更多

As of Grails 1.3 the Category domain class collides with with a new groovy.lang.Category. To make the application work you have three choices rename the Category to something else like CategoryItem, put Category into a package or rename it Group which would require a mapping since Group is a reserved word in SQL.

It is really more of a Java namespace issue than a Grails or Groovy issue. Since the Category class was introduced in Groovy 1.6 into the groovy.lang package which is implicitly imported in Groovy causing the ambiguity and in this case the JVM class loader will find groovy.lang.Category first. The concept of Java packages was created to prevent this. This points out putting domain classes into a package should be considered a best practice.

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics