首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Ehcache 3.x配置键/值类型错误

Ehcache 3.x配置键/值类型错误
EN

Stack Overflow用户
提问于 2017-08-17 09:30:55
回答 1查看 1.4K关注 0票数 0

我将SpringFramwork与Ehcache 3.x集成,并在ehcache.xml中指定键/值类型时获得异常。这是我的配置:

代码语言:javascript
复制
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.ehcache.org/v3" xmlns:jsr107="http://www.ehcache.org/v3/jsr107"
xsi:schemaLocation="http://www.ehcache.org/v3 http://www.ehcache.org/schema/ehcache-core-3.0.xsd http://www.ehcache.org/v3/jsr107 http://www.ehcache.org/schema/ehcache-107-ext-3.0.xsd">

<persistence directory="${user.home}/.ehcache" />
<cache alias="mycache">
    <key-type>java.lang.String</key-type>
    <value-type>java.lang.String</value-type>
    <resources>
        <offheap unit="GB">1</offheap>
        <heap unit="MB">300</heap>
        <disk unit="GB" persistent="true">10</disk>
    </resources>
</cache>

我得到异常:Cache XXX指定键/值类型。使用getCache(字符串、类、类)。下面是堆栈:

代码语言:javascript
复制
Caused by: java.lang.IllegalArgumentException: Cache [homeFeeds] specifies key/value types. Use getCache(String, Class, Class)
at org.ehcache.jsr107.Eh107CacheManager.getCache(Eh107CacheManager.java:297)
at org.springframework.cache.jcache.JCacheCacheManager.loadCaches(JCacheCacheManager.java:105)
at org.springframework.cache.support.AbstractCacheManager.initializeCaches(AbstractCacheManager.java:61)
at org.springframework.cache.support.AbstractCacheManager.afterPropertiesSet(AbstractCacheManager.java:50)
at org.springframework.cache.jcache.JCacheCacheManager.afterPropertiesSet(JCacheCacheManager.java:97)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624)
... 35 more

我的配置有问题吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-08-18 14:23:29

我建议您在my answer on this other question上阅读,这与您的非常相似,如果不是相同的话

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45731408

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档