grails schema-export因NullPointerException而失败

时间:2015-04-08 14:29:13

标签: hibernate grails gorm

当我启动Grails命令'grails test schema-export'时,它失败并显示错误

java.lang.NullPointerException: Cannot invoke method containsBean() on null object

这是我的数据源定义:

test {
    dataSource {
        dbCreate = "create-drop"
        url = "jdbc:h2:mem:testDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE"
        pooled = true
        jmxExport = true
        driverClassName = "org.h2.Driver"
        username = "sa"
        password = ""
    }
}

Hibernate闭包:

hibernate {
    cache.use_second_level_cache = true
    cache.use_query_cache = false
    cache.region.factory_class = 'org.hibernate.cache.ehcache.EhCacheRegionFactory'
    singleSession = true
    flush.mode = 'manual'
    show_sql = true
}

当我运行单元测试时,所有工作都完美无缺,所以我想这不是GORM模型问题。

堆栈跟踪细节:

Problem executing: test schema-export stdout
Command terminated with an exception: java.lang.Exception (see details for partial output)
Command: GrailsCommand(P/LEARNGRAILS> test schema-export)
---- System.out ----
.
|Environment set to test
......................................
..Error 
|
java.lang.NullPointerException: Cannot invoke method containsBean() on null object
Error |
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
Error |
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
Error |
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
Error |
    at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
Error |
    at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)
Error |
    at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102)
Error |
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:194)
Error |
    at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:391)
Error |
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Error |
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
Error |
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Error |
    at java.lang.reflect.Method.invoke(Method.java:601)
Error |
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:207)
Error |
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:68)
Error |
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
......
------System.err:-----------
Loading Grails 2.4.4    

更新: 它也失败了'test dbm-generate-gorm-changelog changelog.groovy'和迁移插件。也许是项目的一部分?

通过删除可搜索的插件部分解决,请参阅下面的评论。 “部分”,因为我仍然不确切知道发生了什么。

0 个答案:

没有答案