Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.lang.NoClassDefFoundError: org/hibernate/cache/spi/RegionFactory - When upgrading from spring 3 to spring 4

I'm updating my spring project from 3.0.5 to 4.0.3.

Everything's building fine, but at boot time, when spring tries to create beans, I'm hitting this error message:

enter image description here

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:

My dependencies look like:

enter image description here

enter image description here

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.

Any ideas how I can get this project building with 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.

EDIT: I'm trying to avoid updating my hibernate past 4.x.y as this project is very large and uses HibernateDaoSupport and HibernateTemplate very extensively (thousands of independent usages which would take a long time to refactor)

like image 649
Paul Avatar asked Oct 20 '22 13:10

Paul


1 Answers

Update the Hibernate Version.

After Hibernate version 4.0.0.Final they chage the package from RegionFactory.

3.6.10.Final: org.hibernate.cache.RegionFactory 4.0.0.Final: org.hibernate.cache.spi.RegionFactory.

like image 181
Lucio Almeida Avatar answered Oct 24 '22 14:10

Lucio Almeida