What is this error in spring mvc integrated via memcache

842 views Asked by At

I want to use simple-spring-memcached to cache data. so using this https://code.google.com/p/simple-spring-memcached/wiki/Getting_Started for my purpose. i add in my dispatcher-servlet.xml

  <aop:aspectj-autoproxy />
  <import resource="simplesm-context.xml" /> 
  <bean name="cacheManager" class="com.google.code.ssm.spring.SSMCacheManager">
    <property name="caches">
        <set>
            <bean class="com.google.code.ssm.spring.SSMCache">
                <constructor-arg name="cache" index="0" ref="defaultCache"/>
                <!-- 5 minutes -->
                <constructor-arg name="expiration" index="1" value="0"/>
                <!-- @CacheEvict(..., "allEntries" = true) doesn't work -->
                <constructor-arg name="allowClear" index="2" value="false"/>
            </bean>
        </set>
    </property>

</bean>
<bean name="defaultCache" class="com.google.code.ssm.CacheFactory">
    <property name="cacheName" value="defaultCache"/>
    <property name="cacheClientFactory">
        <bean name="cacheClientFactory"  class="com.google.code.ssm.providers.xmemcached.MemcacheClientFactoryImpl"/>
    </property>
    <property name="addressProvider">
        <bean class="com.google.code.ssm.config.DefaultAddressProvider">
            <property name="address" value="127.0.0.1:11211"/>
        </bean>
    </property>
    <property name="configuration">
        <bean class="com.google.code.ssm.providers.CacheConfiguration">
            <property name="consistentHashing" value="true"/>
        </bean>
    </property>
  </bean>

i also add simple-spring-memcached-3.5.0.jar and spymemcache.jar,spymemcache-provider.jar to lib folder. but when i run my project occur this exception:

 Cannot find class **[net.nelz.simplesm.config.MemcachedClientFactory]** for bean with name 'memcachedClientFactory' defined in ServletContext resource [/WEB-INF/simplesm-context.xml]; nested exception is java.lang.ClassNotFoundException: net.nelz.simplesm.config.MemcachedClientFactory
2

There are 2 answers

3
Hadi On

you must add lib for this class.

8
ragnor On

It seams that you have also an old version of Simple Spring Memcached on your classpath. The class net.nelz.simplesm.config.MemcachedClientFactory is no longer available in 3.x. Check your classpath and remove all Simple Spring Memcached artifacts older than 3.5.0.