Caused by: java.lang.NoClassDefFoundError: net/sf/ehcache/CacheException

I am getting the following exception. Please let me know what am I missing? Thanks in advance.

Caused by: java.lang.NoClassDefFoundError: net/sf/ehcache/CacheException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
at java.lang.Class.getConstructor0(Class.java:2699)
at java.lang.Class.getDeclaredConstructor(Class.java:1985)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:54)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:757)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:722)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:386)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:249)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:155)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:246)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:267)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:110)

Related Post

java.lang.NoClassDefFoundError: org/apache/commons/codec/DecoderException
nested exception is java.lang.NoClassDefFoundError: net/sf/ezmorph/Morpher
nested exception is java.lang.NoClassDefFoundError: org/apache/poi/hssf/usermodel /HSSFCellStyle
nested exception is java.lang.NoClassDefFoundError: org/apache/poi/hssf/usermodel /HSSFCellStyle
java.sql.SQLException: Closed Connection

Comments

4 Responses to “Caused by: java.lang.NoClassDefFoundError: net/sf/ehcache/CacheException”

  1. Abhishek on September 10th, 2008 11:31 pm

    You are missing ehcache.jar from your class path. You must include this jar to get rid of the exception. If you don’t have this jar, you can download it from here

  2. Gautam on September 26th, 2008 10:44 pm

    Since you are getting NoClassDefFoundError and not ClassNotFoundException, it means the JAR is there in your classpath but classloader is not able to load this class. May be due to version mismatch. Like you are using JDK1.4 and trying to use a class complied in JDK1.5 or above version. Link might help:
    http://www.jroller.com/sjivan/entry/difference_between_classnotfoundexception_and_noclassdeffounderror

  3. Gajendra Kumar Garg on June 9th, 2009 4:12 pm

    This problem is realated to Classloading problems – you have the two jars inside different classloaders . Make sure that Hibernate and ehcache jar are in the same dir (thus the same classpath and classloader) and make sure there are no duplicates or older versions.

  4. karthik on January 7th, 2010 2:22 pm

    i also have the same problem
    In command promt go to ur folder whr ur java file exist and write this
    set classpath=%classpath%;.;
    it works.

Leave a Reply




Technology