在我的Grails 2.5.4应用中,我安装了以下插件
compile ":cache:1.1.8"
runtime ":cache-ehcache:1.0.5"
运行
grails run-app
时,在启动时出现以下错误java.lang.NullPointerException
at grails.plugin.cache.ehcache.GrailsEhCacheManagerFactoryBean$ReloadableCacheManager.rebuild(GrailsEhCacheManagerFactoryBean.java:171)
at grails.plugin.cache.ehcache.EhcacheConfigLoader.reload(EhcacheConfigLoader.groovy:63)
at grails.plugin.cache.ConfigLoader.reload(ConfigLoader.groovy:42)
at CacheGrailsPlugin.reloadCaches(CacheGrailsPlugin.groovy:202)
at CacheGrailsPlugin$_closure3.doCall(CacheGrailsPlugin.groovy:158)
如果我构建WAR并查看
lib
目录,则它包含以下两个依赖项:根据this issue中的建议,我排除了
ehcache-core
中的传递性BuildConfig
依赖项runtime (":hibernate:3.6.10.18") {
excludes "ehcache-core"
}
如果我重建WAR,则排除了
ehcache-core
JAR,但在运行grails run-app
时仍会在启动时遇到相同的错误。我怀疑问题的原因是ehcache依赖关系,但我不知道应该使用哪个JAR。
最佳答案
升级到休眠状态3.6.10.19似乎可以解决此问题。构建WAR时,包括以下ehcache依赖项:
关于grails - 初始化高速缓存导致 “grails run-app”失败时发生异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53451212/