Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

java.lang.ClassNotFoundException: org.hibernate.cache.EhCacheProvider In my pom.xml dependency for ecahce is like below

   <dependency>
        <groupId>net.sf.ehcache</groupId>
        <artifactId>ehcache</artifactId>
        <version>1.5.0</version>
    </dependency>

but still i am facing the problem classNotFound Exception

Please help me out iam trying this out from past 2 days

share|improve this question
    
The class you are missing is in a package org.hibernate, so it should come from Hibernate, no with EhCahe. (Although I imagine it would also depend on EhCache) What dependencies from hibernate have you included? –  madth3 Mar 10 '12 at 2:25
    
This is the list of hibernate Maven artifacts: docs.jboss.org/hibernate/core/4.0/quickstart/en-US/html/… –  madth3 Mar 10 '12 at 2:26
add comment

2 Answers

The dependency you're looking for is the following I think (Perhaps a different version)

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-ehcache</artifactId>
    <version>3.6.2.Final</version>
</dependency>

I searched for the missing class using Maven Central's search site:

http://search.maven.org/#search|ga|1|fc%3A%22org.hibernate.cache.EhCacheProvider%22

share|improve this answer
2  
For anyone who is confused why newer hibernate-ehcache 4.x.x artifacts don't contain org.hibernate.cache.EhCacheProvider: In "newer" Hibernate versions, the configuration parameters have changed... in 4.x.x versions, it's correct to use the following: jpaProperties.setProperty("hibernate.cache.region.factory_class", "org.hibernate.cache.ehcache.EhCacheRegionFactory"); –  Abdull Jan 29 '13 at 22:19
add comment

When I ran into this problem, it was because I was trying to update the version of hibernate. When moving from hibernate 3.2 to 3.3, the packages split. I had tried to replace hibernate with hibernate-core. Reverting back to the full hibernate package (at 3.2 level) fixed my problem.

During my next round of updates, I will probably need to replace the full hibernate package with hibernate-core and hibernate-ehcache as referenced above.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.