1
回答
spring注解配置ehcache报错
利用AWS快速构建适用于生产的无服务器应用程序,免费试用12个月>>>   
<?xml version="1.0" encoding="UTF-8"?>
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd"
	updateCheck="false">
	<diskStore path="java.io.tmpdir" />
	
	<defaultCache maxElementsInMemory="10000" eternal="false"
		overflowToDisk="true" timeToIdleSeconds="300" timeToLiveSeconds="180"
		diskPersistent="false" diskExpiryThreadIntervalSeconds="120" />

	<cache name="DEFAULT_CACHE" maxElementsInMemory="10000" eternal="false"
		timeToIdleSeconds="300000" timeToLiveSeconds="600000" overflowToDisk="true" />
</ehcache>


<ehcache:annotation-driven cache-manager="ehCacheManager" />
	<bean id="ehCacheManager"
		class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
		<property name="configLocation" value="classpath:ehcache.xml" />
	</bean>
@Cacheable(cacheName=CacheConstant.CACHE_NAME)
public List<> findList() {
		
		return;
	}



当访问list方法的时候报错

java.lang.NoSuchMethodError: net.sf.ehcache.Ehcache.getWithLoader(Ljava/lang/Object;Lnet/sf/ehcache/loader/CacheLoader;Ljava/lang/Object;)Lnet/sf/ehcache/Element;

依赖为

<dependency>
			<groupId>com.googlecode.ehcache-spring-annotations</groupId>
			<artifactId>ehcache-spring-annotations</artifactId>
			<version>1.2.0</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-context-support</artifactId>
			<version>3.2.1.RELEASE</version>
		</dependency>

谷歌百度都搜了一下,似乎没有人遇到这个错误





举报
yongzhong
发帖于4年前 1回/1K+阅
顶部