Grails context.GrailsContextLoader初始化应用程序时出错:类[]上的方法在Grails应用程序之外使用

时间:2014-01-28 21:00:11

标签: hibernate grails gorm

我的grails版本:2.3.4

Hibernate插件:运行时“:hibernate:3.6.10.6”

这是Bootstrap.groovy中生成错误的行:

  

def adminRole = new Role(authority:'ROLE_ADMIN')。save(flush:true)

实际上任何类(控制器,Bootstrap.groovy)中的任何保存操作都会导致此错误。

但是当我获得在另一台计算机上创建的域类时,它运行正常,没有错误。

有什么建议吗?

感谢。

完整的堆栈跟踪:

ERROR context.GrailsContextLoader Error initializing the application: Method on class [etezia.Role] was used outside of a Grails application. If running in the context of a test using the mocking API or bootstrap Grails correctly.
java.lang.IllegalStateException: Method on class [etezia.Role] was used outside of a Grails application. If running in the context of a test using the mocking API or bootstrap Grails correctly.
    at BootStrap$_closure1.doCall(BootStrap.groovy:9)
    at grails.util.Environment.evaluateEnvironmentSpecificBlock(Environment.java:308)
    at grails.util.Environment.executeForEnvironment(Environment.java:301)
    at grails.util.Environment.executeForCurrentEnvironment(Environment.java:277)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)

0 个答案:

没有答案
相关问题