Announcement Announcement Module
Collapse
No announcement yet.
ClassNotFoundException: EhCacheBasedUserCache with Security 3 and EhCache 2.2.0 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • ClassNotFoundException: EhCacheBasedUserCache with Security 3 and EhCache 2.2.0

    Hi!!
    I'm using Security 3.0.3.RELEASE, Spring 3.0.4.RELEASE and EhCache 2.2.0 to implement Cache in the Users objects but I gat this error:

    Caused by: org.springframework.beans.factory.CannotLoadBeanCl assException: Cannot find class [org.springframework.security.providers.dao.cache.E hCacheBasedUserCache] for bean with name 'userCache' defined in class path resource [securityAppCtx.xml]; nested exception is java.lang.ClassNotFoundException: org.springframework.security.providers.dao.cache.E hCacheBasedUserCache

    My conf is:

    Code:
    <authentication-manager>
    		<authentication-provider>
    			<password-encoder hash="md5" />
    			<jdbc-user-service id="jdbcUserService" data-source-ref="dataSource" cache-ref="userCache" />
    		</authentication-provider>
    	</authentication-manager>
    
    	<beans:bean id="userCache"
    		class="org.springframework.security.providers.dao.cache.EhCacheBasedUserCache">
    		<beans:property name="cache" ref="userEhCache" />
    	</beans:bean>
    
    	<beans:bean id="userEhCache"
    		class="org.springframework.cache.ehcache.EhCacheFactoryBean">
    		<beans:property name="cacheManager" ref="cacheManager" />
    		<beans:property name="cacheName" value="userCache" />
    	</beans:bean>
    
    	<beans:bean id="cacheManager"
    		class="org.springframework.security.core.userdetails.cache.EhCacheManagerFactoryBean" />
    Exploring a little I found this class in different packages with the version of Security:

    Spring Security 3
    org.springframework.security.core.userdetails.cach e.EhCacheBasedUserCache

    But is searching for:
    org.springframework.security.providers.dao.cache.E hCacheBasedUserCache
    In Spring Security 2.0.x

    I added this jar but I have many conflicts...

    How can I solve this??
    Thks in advance...

  • #2
    Originally posted by neodevelop View Post
    Spring Security 3
    org.springframework.security.core.userdetails.cach e.EhCacheBasedUserCache

    But is searching for:
    org.springframework.security.providers.dao.cache.E hCacheBasedUserCache
    In Spring Security 2.0.x

    I added this jar but I have many conflicts...

    How can I solve this??
    Thks in advance...
    I'm curious why you were adding 2.x classes in the first place. Are you migrating from using Spring Security 2.x? Did you just accidentally look at the 2.x documentation (the doc is versioned)?

    You are right it, along with other classes, got moved in Spring Security 3. I'm not sure how to fix the "many conflicts" since you haven't elaborated but it seems like you have already gotten this one figured out. If you have other specific problems you can post them. There is a class_mapping_from_2.0.txt in the download that can help you figure out where classes have migrated to. Another option is the Spring Security book which has a chapter dedicated to migrating.

    Comment


    • #3
      I'm working in Spring 3 and Security 3

      I'm developing an app with Security 3 but for check it out I did review the Security 2 only to see if the class was there...only I try to use it...

      Comment

      Working...
      X