i'm currently trying out the first time grails 3.
I created an plugin (which should contain some Domain Classes) and an simple application.
Now I'm getting following Error:
Caused by: java.lang.IllegalStateException: Either class [de.foo.Author] is not a domain class or GORM has not been initialized correctly or has already been shutdown. Ensure GORM is loaded and configured correctly before calling any methods on a GORM entity.
Author Domain Class:
class Author {
String name
}
I'm unsing Grails 3.2.9 with following dependencies:
Plugin
compile "org.springframework.boot:spring-boot-starter-logging"
compile "org.springframework.boot:spring-boot-autoconfigure"
compile "org.grails:grails-core"
compile "org.springframework.boot:spring-boot-starter-actuator"
compile "org.springframework.boot:spring-boot-starter-tomcat"
compile "org.grails:grails-dependencies"
compile "org.grails:grails-web-boot"
compile "org.grails.plugins:cache"
compile "org.grails.plugins:scaffolding"
console "org.grails:grails-console"
profile "org.grails.profiles:web-plugin"
provided "org.grails:grails-plugin-services"
provided "org.grails:grails-plugin-domain-class"
testCompile "org.grails:grails-plugin-testing"
testCompile "org.grails.plugins:geb"
testRuntime "org.seleniumhq.selenium:selenium-htmlunit-driver:2.47.1"
testRuntime "net.sourceforge.htmlunit:htmlunit:2.18"
compile "org.grails.plugins:hibernate5"
compile "org.hibernate:hibernate-core:5.1.3.Final"
compile "org.hibernate:hibernate-ehcache:5.1.3.Final"
compile 'org.grails.plugins:spring-security-cas:3.0.0'
compile 'org.grails.plugins:spring-security-core:3.1.2'
compile "org.apache.poi:poi:3.16"
compile "org.apache.poi:poi-ooxml:3.16"
compile "org.apache.poi:ooxml-schemas:1.0"
compile 'org.grails.plugins:wkhtmltopdf:1.0.0.RC7'
Application
compile "org.springframework.boot:spring-boot-starter-logging"
compile "org.springframework.boot:spring-boot-autoconfigure"
compile "org.grails:grails-core"
compile "org.springframework.boot:spring-boot-starter-actuator"
compile "org.springframework.boot:spring-boot-starter-tomcat"
compile "org.grails:grails-dependencies"
compile "org.grails:grails-web-boot"
compile "org.grails.plugins:cache"
compile "org.grails.plugins:scaffolding"
compile "org.grails.plugins:hibernate5"
compile "org.hibernate:hibernate-core:5.1.3.Final"
compile "org.hibernate:hibernate-ehcache:5.1.3.Final"
console "org.grails:grails-console"
profile "org.grails.profiles:web"
runtime "com.bertramlabs.plugins:asset-pipeline-grails:2.14.1"
testCompile "org.grails:grails-plugin-testing"
testCompile "org.grails.plugins:geb"
testRuntime "org.seleniumhq.selenium:selenium-htmlunit-driver:2.47.1"
testRuntime "net.sourceforge.htmlunit:htmlunit:2.18"
runtime "com.h2database:h2"
compile "de.foo:bar:0.1"
runtime 'com.bertramlabs.plugins:asset-pipeline-grails:2.14.3'
assets 'com.bertramlabs.plugins:less-asset-pipeline:2.14.3'
runtime "mysql:mysql-connector-java:5.1.29"
Do you guys have any suggestion or answers for me how I store domain classes in the plugin and use it in some applications?
答案 0 :(得分:-1)
对于GORM错误,版本必须相同。对于其他grails的东西,groovy版本通常必须是相同的二进制兼容性。虽然在每种情况下都不是100%要求保持每个版本都相同,但是在grails 3中它比在grails 2中更加必要,并且在这一点上可能只是最佳实践。