java.lang.IllegalStateException:class [coconut.User] 不是域 class 或者
java.lang.IllegalStateException: Either class [coconut.User] is not a domain class or
所以我收到了这个错误。我确定它与东西的不兼容版本有关,但我不知道我做错了什么。
我正在通过 sdkman 做这件事,我应该这样做...grails --version
给我 3.2.11
。
2017-06-29 22:17:15.406 ERROR --- [nio-8080-exec-1] o.g.web.errors.GrailsExceptionResolver : IllegalStateException occurred when processing request: [GET] /user
Either class [coconut.User] 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.. Stacktrace follows:
java.lang.reflect.InvocationTargetException: null
at org.grails.core.DefaultGrailsControllerClass$ReflectionInvoker.invoke(DefaultGrailsControllerClass.java:211)
at org.grails.core.DefaultGrailsControllerClass.invoke(DefaultGrailsControllerClass.java:188)
at org.grails.web.mapping.mvc.UrlMappingsInfoHandlerAdapter.handle(UrlMappingsInfoHandlerAdapter.groovy:90)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
at org.springframework.boot.web.filter.ApplicationContextHeaderFilter.doFilterInternal(ApplicationContextHeaderFilter.java:55)
at org.grails.web.servlet.mvc.GrailsWebRequestFilter.doFilterInternal(GrailsWebRequestFilter.java:77)
at org.grails.web.filters.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:67)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalStateException: Either class [coconut.User] 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.
at org.grails.datastore.gorm.GormEnhancer.stateException(GormEnhancer.groovy:427)
at org.grails.datastore.gorm.GormEnhancer.findStaticApi(GormEnhancer.groovy:296)
at org.grails.datastore.gorm.GormEnhancer.findStaticApi(GormEnhancer.groovy:292)
at org.grails.datastore.gorm.GormEntity$Trait$Helper.currentGormStaticApi(GormEntity.groovy:1341)
at org.grails.datastore.gorm.GormEntity$Trait$Helper.getCount(GormEntity.groovy:627)
at coconut.UserController.create(UserController.groovy:5)
... 14 common frames omitted
重现步骤
- 下载下面的压缩项目。
grails clean; grails run-app
- 在第二个终端中:
curl localhost:8080/user
预期行为
我没有收到那个错误。
实际行为
我收到那个错误。
环境信息
- 操作系统:Ubuntu17.04
- Grails 版本: 3.2.11
- JDK 版本: 1.8.0_131
示例应用程序
放:
compile "org.grails.plugins:hibernate5"
进入您在 build.gradle
中的 "dependencies" 区块
所以我收到了这个错误。我确定它与东西的不兼容版本有关,但我不知道我做错了什么。
我正在通过 sdkman 做这件事,我应该这样做...grails --version
给我 3.2.11
。
2017-06-29 22:17:15.406 ERROR --- [nio-8080-exec-1] o.g.web.errors.GrailsExceptionResolver : IllegalStateException occurred when processing request: [GET] /user
Either class [coconut.User] 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.. Stacktrace follows:
java.lang.reflect.InvocationTargetException: null
at org.grails.core.DefaultGrailsControllerClass$ReflectionInvoker.invoke(DefaultGrailsControllerClass.java:211)
at org.grails.core.DefaultGrailsControllerClass.invoke(DefaultGrailsControllerClass.java:188)
at org.grails.web.mapping.mvc.UrlMappingsInfoHandlerAdapter.handle(UrlMappingsInfoHandlerAdapter.groovy:90)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
at org.springframework.boot.web.filter.ApplicationContextHeaderFilter.doFilterInternal(ApplicationContextHeaderFilter.java:55)
at org.grails.web.servlet.mvc.GrailsWebRequestFilter.doFilterInternal(GrailsWebRequestFilter.java:77)
at org.grails.web.filters.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:67)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalStateException: Either class [coconut.User] 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.
at org.grails.datastore.gorm.GormEnhancer.stateException(GormEnhancer.groovy:427)
at org.grails.datastore.gorm.GormEnhancer.findStaticApi(GormEnhancer.groovy:296)
at org.grails.datastore.gorm.GormEnhancer.findStaticApi(GormEnhancer.groovy:292)
at org.grails.datastore.gorm.GormEntity$Trait$Helper.currentGormStaticApi(GormEntity.groovy:1341)
at org.grails.datastore.gorm.GormEntity$Trait$Helper.getCount(GormEntity.groovy:627)
at coconut.UserController.create(UserController.groovy:5)
... 14 common frames omitted
重现步骤
- 下载下面的压缩项目。
grails clean; grails run-app
- 在第二个终端中:
curl localhost:8080/user
预期行为
我没有收到那个错误。
实际行为
我收到那个错误。
环境信息
- 操作系统:Ubuntu17.04
- Grails 版本: 3.2.11
- JDK 版本: 1.8.0_131
示例应用程序
放:
compile "org.grails.plugins:hibernate5"
进入您在 build.gradle
中的 "dependencies" 区块