Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9250029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:20:53+00:00 2026-06-18T10:20:53+00:00

I am trying to configure Ehcache (2.6.0) as Hibernate (3.6.4) second level cache. I

  • 0

I am trying to configure Ehcache (2.6.0) as Hibernate (3.6.4) second level cache.
I have set the following properties in the spring context file

<prop key="hibernate.cache.use_second_level_cache">true</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="hibernate.cache.region.factory_class">net.sf.ehcache.hibernate.SingletonEhCacheRegionFactory</prop>

When I start the application, it fails with the exception:java.lang.ClassCastException: net.sf.ehcache.hibernate.SingletonEhCacheRegionFactory cannot be cast to org.hibernate.cache.RegionFactory

Here is the stacktrace:

Caused by: org.hibernate.HibernateException: could not instantiate RegionFactory [net.sf.ehcache.hibernate.SingletonEhCacheRegionFactory]
    at org.hibernate.cfg.SettingsFactory.createRegionFactory(SettingsFactory.java:423)
    at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:280)
    at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2863)
    at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2859)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1870)
    Caused by: java.lang.ClassCastException: net.sf.ehcache.hibernate.SingletonEhCacheRegionFactory cannot be cast to org.hibernate.cache.RegionFactory
    at org.hibernate.cfg.SettingsFactory.createRegionFactory(SettingsFactory.java:409)

I have looked at the source and observed that SingletonEhCacheRegionFactory extends AbstractEhcacheRegionFactory and AbstractEhcacheRegionFactory implements RegionFactory

The code at SettingsFactory.java:409 is

            return (RegionFactory) ReflectHelper.classForName( regionFactoryClassName )
                    .getConstructor( Properties.class )
                    .newInstance( properties );

Everything seems to be in place but I still get the exception. Any clues ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T10:20:55+00:00Added an answer on June 18, 2026 at 10:20 am

    Can you try by providing Provider Class:

    org.hibernate.cache.EhCacheProvider

    And also make sure that you have added required jar for ehCache.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have Hibernate with 2nd level cache provided by Ehcache. I have Parent and
I am trying to configure the hibernate.cfg.xml file to use memcache. I see the
I'm trying to configure spring secure annotations, I already managed to set spring security
Im trying to configure a .htaccess RewriteRule and i'm struggling. I have a domain
I am trying to configure logback-classic to handle the following situation: All messages originating
I'm trying to configure a one to one relationship between entities which both have
I'm trying to configure CC.NET to send email notifications. I have googled a lot
I'm trying to configure a form for Zend_Form using Zend_Config_Ini, and wish to set
I have been trying to configure Windsor to provide a different implementation for a
I am trying to configure a mirror group for ehcache using terracotta.. My understanding

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.