【发布时间】:2014-12-06 16:42:43
【问题描述】:
最近我正在将一个简单的 Grails 应用程序与 Searchable 插件集成。我发现 Searchable 插件不适用于 Hibernate 4 库。
在这里您可以找到一个示例应用程序,其中仅包含干净的 Grails 2.4 应用程序,并且仅添加了 Searchable 插件 - https://github.com/wololock/grails-searchable-example
当我运行这个应用程序时:
runtime ":hibernate4:4.3.5.5"
依赖,它不会启动并抛出异常:
ClassNotFoundException: org.hibernate.impl.SessionFactoryImpl
我已经发现,在 Hibernate4 中,SessionFactoryImpl 被移到了 org.hibernate.internal 包中,而且 Compass 似乎在旧位置寻找这个类:
2014-10-11 19:41:58,142 [localhost-startStop-1] ERROR context.GrailsContextLoaderListener - Error initializing the application: org/hibernate/impl/SessionFactoryImpl
Message: org/hibernate/impl/SessionFactoryImpl
Line | Method
->> 95 | injectLifecycle in org.compass.gps.device.hibernate.lifecycle.DefaultHibernateEntityLifecycleInjector
切换回:
runtime ":hibernate:3.6.10.17"
改变
cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory'
在 DataSource.groovy 中解决了这个问题。
我的问题是: 是否有任何解决方法可以在 Hibernate 4 中使用 Searchable 插件,或者我们必须等待或修复 Compass/Searchable 源代码中的问题?您是如何在 Grails 应用程序中处理这个问题的?我将不胜感激您的提示。
【问题讨论】:
-
这就是 Grails 让我心碎的地方......所有这些很棒的插件,永远无法与最新版本的 Grails 一起使用,因此不得不花费 99% 的时间寻找修复和解决方法,这令人沮丧跨度>
标签: hibernate grails searchable