Announcement Announcement Module
Collapse
No announcement yet.
net/sf/ehcache/Ehcache - Class not found problem. Page Title Module
Move Remove Collapse
This topic is closed
X
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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

  • #2
    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.

    Comment


    • #3
      Use the version of ehcache supplied with your Spring version. I guess it needs 1.2.x version instead of 1.1.

      Comment


      • #4
        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.

        Comment


        • #5
          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

          Comment


          • #6
            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.

            Comment


            • #7
              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

              Comment


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

                Comment

                Working...
                X