ドメインクラスにパッケージを指定しようという話
Grails Tip of the Day: Always use packages
grails1.1からCategoryというドメインクラスを作ると起動時にエラーになるようです。
WindowsXP + groovy-1.6.0 + grails1.1で試したところ確かにエラーに。
Environment set to development [groovyc] Compiling 2 source files to C:\Documents and Settings\yuhei0718\.grails\1.1\projects\test\classes [groovyc] org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, C:\Users\yuhei0718\work\grailsWork\test\grails -app\controllers\CategoryController.groovy: 84: You cannot create an instance from the abstract interface 'groovy.lang.Category'. [groovyc] @ line 84, column 32. [groovyc] def categoryInstance = new Category() [groovyc] ^ [groovyc] C:\Users\yuhei0718\work\grailsWork\test\grails-app\controllers\CategoryController.groovy: 90: You cannot create an instance fr om the abstract interface 'groovy.lang.Category'. [groovyc] @ line 90, column 32. [groovyc] def categoryInstance = new Category(params) [groovyc] ^ [groovyc] C:\Users\yuhei0718\work\grailsWork\test\grails-app\controllers\CategoryController.groovy: 84: You cannot create an instance fr om the abstract interface 'groovy.lang.Category'. [groovyc] @ line 84, column 32. [groovyc] def categoryInstance = new Category() [groovyc] ^ [groovyc] C:\Users\yuhei0718\work\grailsWork\test\grails-app\controllers\CategoryController.groovy: 90: You cannot create an instance fr om the abstract interface 'groovy.lang.Category'. [groovyc] @ line 90, column 32. [groovyc] def categoryInstance = new Category(params) [groovyc] ^ [groovyc] C:\Users\yuhei0718\work\grailsWork\test\grails-app\controllers\CategoryController.groovy: 84: You cannot create an instance fr om the abstract interface 'groovy.lang.Category'. [groovyc] @ line 84, column 32. [groovyc] def categoryInstance = new Category() [groovyc] ^ [groovyc] C:\Users\yuhei0718\work\grailsWork\test\grails-app\controllers\CategoryController.groovy: 90: You cannot create an instance fr om the abstract interface 'groovy.lang.Category'. [groovyc] @ line 90, column 32. [groovyc] def categoryInstance = new Category(params) [groovyc] ^ [groovyc] [groovyc] 6 errors Compilation error: Compilation Failed
grails-1.0.4だと問題なく起動しました。
原文にあるとおり
grails create-domain-class org.company.Category
とかにすればOKでした。
categoryとか結構チュートリアル的なサンプルで作りそうなドメインなので、古い資料でgrailsは1.1なんて状態だと
はまる人いるかもしれない。