java.lang.ClassNotFoundException: net.sf.ehcache.hibernate.EhCacheRegionFactory cannot be found

1,322 views
Skip to first unread message

Jason Trinidad

unread,
Feb 24, 2016, 1:57:21 PM2/24/16
to ehcache-users
Hello everyone,

I am trying to add 2nd level caching to an existing Eclipse project. It is using hibernate 3.6.0.final, so I added hibernate-ehcache-3.6.0.final, and ehcache-core-1.5.0. I added to my hibernateProperties the following lines, 

<prop key="hibernate.cache.region.factory_class">net.sf.ehcache.hibernate.EhCacheRegionFactory</prop>
<prop key="hibernate.cache.provider_configuration">config/ehcache.xml</prop>
<prop key="hibernate.cache.use_second_level_cache">true</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>

But I get an exception when I run the code

java.lang.ClassNotFoundException: net.sf.ehcache.hibernate.EhCacheRegionFactory cannot be found

I've tried multiple things, 

Tried upgrading to:
hibernate 3.6.10.final, hibernate-ehcache-3.6.10.final, and ehcache-core-2.4.3
, but I just got the same error.

I also tried changing 
<prop key="hibernate.cache.region.factory_class">net.sf.ehcache.hibernate.EhCacheRegionFactory</prop>
to
<prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
But I got the error: java.lang.ClassNotFoundException: net.sf.ehcache.CacheException cannot be found

I also tried 
<prop key="hibernate.cache.provider_class">net.sf.ehcache.hibernate.EhCacheProvider</prop>
but go an error java.lang.ClassNotFoundException: net.sf.ehcache.hibernate.EhCacheProvider cannot be found


I'm using Windows 7, and Eclipse Kepler
Any clues would be appreciated.

Thanks.

Fabien Sanglier

unread,
Mar 1, 2016, 3:31:05 PM3/1/16
to ehcach...@googlegroups.com
hey,

I think you need to use a different factory that is actually part of the "hibernate-ehcache-3.6.0.final" jar ( org.hibernate.cache.ehcache package)

eg. 

hibernate.cache.region.factory_class=org.hibernate.cache.ehcache.EhCacheRegionFactory
or
hibernate.cache.region.factory_class=org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory

Let us know.

Thanks,

Fabien

--
You received this message because you are subscribed to the Google Groups "ehcache-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ehcache-user...@googlegroups.com.
To post to this group, send email to ehcach...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ehcache-users/44fae84e-bfba-43b2-9a4d-cd2430e33c96%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Fabien Sanglier
fabiens...@gmail.com
Reply all
Reply to author
Forward
0 new messages