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

15,866

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.

Share:
15,866
Paul
Author by

Paul

I'm still pretty junior. My dayjob is Enterprise web applications/services in big finance. Fun. Most of my questions are java/spring/oracleDB/javascript based. Some of my interests outside of work are natural computing and information filtering/recommendation.

Updated on July 01, 2022

Comments

  • Paul
    Paul almost 2 years

    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)

  • Paul
    Paul about 9 years
    I'm trying to avoid updating my Hibernate version past 4.x.y, as this upgrade breaks HibernateDaoSupport which this project uses very extensively. The documentation seems to imply it works with hibernate 3.6.10.Final?
  • Lucio Almeida
    Lucio Almeida about 9 years
    HibernateDaoSupport does not have breaks. For use Hibernate 4.x.y have a class org.springframework.orm.hibernate4.support.HibernateDaoSuppo‌​rt.
  • Paul
    Paul about 9 years
    The HibernateTemplate just doesn't exist in spring 4 as far as I can see? Trying to avoid code changes as much as possible.
  • Lucio Almeida
    Lucio Almeida about 9 years
    The Spring 4.x.y have a HibernateDaoSupport see here : docs.spring.io/autorepo/docs/spring/4.0.3.RELEASE/javadoc-ap‌​i/…
  • Paul
    Paul about 9 years
    Yes, but no HibernateTemplate, which we have thousands of references to in our code. Any alternative to making 1000s of changes to legacy code is preferable.
  • Lucio Almeida
    Lucio Almeida about 9 years