Results 1 to 8 of 8

Thread: net/sf/ehcache/Ehcache - Class not found problem.

  1. #1

    Default net/sf/ehcache/Ehcache - Class not found problem.

    Hi,
    I am converting the Spring petclinic application per acegi tutorial. When I deploy the application I am getting the following error.

    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'org.springframework.cache.ehcache.EhCacheFactoryB ean#af6da' defined in ServletContext resource [/WEB-INF/applicationContext-acegi-security.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: net/sf/ehcache/Ehcache
    Caused by:
    java.lang.NoClassDefFoundError: net/sf/ehcache/Ehcache

    I am using spring 2.0 and Acegi 1.0.3 and ehceche 1.1. Any help will be appreciated.

    Thanks
    Matt
    Matt 'M

  2. #2
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    Ehcache jar must not be on the classpath, hence the exception. If you are running this as a web app, it should be in MyWebApp/WEB-INF/lib.

  3. #3
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,624

    Default

    Use the version of ehcache supplied with your Spring version. I guess it needs 1.2.x version instead of 1.1.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  4. #4
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    Quote Originally Posted by mdeinum View Post
    Use the version of ehcache supplied with your Spring version. I guess it needs 1.2.x version instead of 1.1.
    Yeah you're right Marten. Just looked at the ehcache.jar that ships with Spring 1.2.x. It's 1.1 and doesn't contain the named class.

  5. #5

    Default

    Hi,
    Thanks for the replies. I got the lattest ehcache.jar. The deployment went a little further but now I am getting a different error.

    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'org.springframework.cache.ehcache.EhCacheManagerF actoryBean#85acc2' defined in ServletContext resource [/WEB-INF/applicationContext-acegi-security.xml]: Invocation of init method failed; nested exception is java.lang.IllegalAccessError: tried to access method net.sf.ehcache.CacheManager.<init>()V from class org.springframework.cache.ehcache.EhCacheManagerFa ctoryBean
    Caused by:
    java.lang.IllegalAccessError: tried to access method net.sf.ehcache.CacheManager.<init>()V from class org.springframework.cache.ehcache.EhCacheManagerFa ctoryBean


    Any help will be greatly appreciated.

    Thanks
    Matt
    Matt 'M

  6. #6
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    I would check over the classpath and ensure you only have the latest jars present. It looks like there might be duplicate jars on the classpath that are causing problems.

  7. #7

    Default

    Hi Karl,
    My apologies. I had used the latest ehcache.jar (1.2.4) and not the one that is distributed with spring (1.2.3) ! It needs exactly 1.2.3 and not 1.2.4 !

    Thanks for the help!

    Matt
    Matt 'M

  8. #8
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    Ah pesky jar versions . Atleast it's working now anyway, glad it's sorted!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •