java.lang.NoClassDefFoundError: org/hibernate/cache/spi/RegionFactory - 从 spring 3 升级到 spring 4 时
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29798583/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
java.lang.NoClassDefFoundError: org/hibernate/cache/spi/RegionFactory - When upgrading from spring 3 to spring 4
提问by Paul
I'm updating my spring project from 3.0.5 to 4.0.3.
我正在将我的 spring 项目从 3.0.5 更新到 4.0.3。
Everything's building fine, but at boot time, when spring tries to create beans, I'm hitting this error message:
一切都很好,但是在启动时,当 spring 尝试创建 bean 时,我遇到了以下错误消息:
The class is of course not present in ehcache-core, hibernate-ehcache, or hibernate-core. In fact, the package spi
just isn't present anywhere it seems. However, I've checked the maven dependencies, and it seems like spring 4.0.3 and hibernate 3.6.10 should be fully compatible. In my pom I directly depend on hibernate-ehcache, which in turn pulls in the appropriate version of ehcache-core automatically(apparently the done thing), like this:
该类当然不存在于 ehcache-core、hibernate-ehcache 或 hibernate-core 中。事实上,该软件包spi
似乎并不存在于任何地方。但是,我检查了 maven 依赖项,似乎 spring 4.0.3 和 hibernate 3.6.10 应该完全兼容。在我的 pom 中,我直接依赖于 hibernate-ehcache,它依次自动引入适当版本的 ehcache-core(显然已经完成),如下所示:
My dependencies look like:
我的依赖项如下所示:
I've searched extensively for this error, but can only find a couple of references to it. Given it's obscurity, I'm guessing it's a configuration within my project somewhere that's referencing this RegionFactory class, however, despite much searching, I can't find a thing.
我已经广泛搜索了这个错误,但只能找到几个对它的引用。鉴于它的模糊性,我猜测它是我项目中某个引用这个 RegionFactory 类的配置,但是,尽管进行了多次搜索,我还是找不到任何东西。
Any ideas how I can get this project building with spring 4.0.3??
有什么想法可以让我用 spring 4.0.3 构建这个项目吗?
I can provide any additional data you need.
我可以提供您需要的任何其他数据。
The key is to get the project building against Spring 4.0.3.Release. Whatever version of hibernate or ehcache enables me to do that doesn't really matter. Obviously My preferencs would be pom changes over reconfiguring over changing code... but I'll take what I can get at this point.
关键是要针对 Spring 4.0.3.Release 构建项目。无论哪种版本的休眠或 ehcache 使我能够做到这一点并不重要。显然,我的偏好是 pom 更改而不是重新配置而不是更改代码......但我会在这一点上得到我能得到的。
EDIT:
I'm trying to avoid updating my hibernate past 4.x.yas this project is very large and uses HibernateDaoSupport
and HibernateTemplate
very extensively (thousands of independent usages which would take a long time to refactor)
编辑:我试图避免更新我的休眠过去4.xy因为这个项目是非常大,用途HibernateDaoSupport
和HibernateTemplate
非常广泛(数以千计的独立用法这将需要很长的时间来重构)
回答by Lucio Almeida
Update the Hibernate Version.
更新休眠版本。
After Hibernate version 4.0.0.Final they chage the package from RegionFactory.
在 Hibernate 版本 4.0.0.Final 之后,他们从 RegionFactory 更改了包。
3.6.10.Final: org.hibernate.cache.RegionFactory 4.0.0.Final: org.hibernate.cache.spi.RegionFactory.
3.6.10.Final:org.hibernate.cache.RegionFactory 4.0.0.Final:org.hibernate.cache.spi.RegionFactory。