spring整合ehcache2.5.2缓存异常-- net.sf.ehcache.CacheException

报错如下:

The source of the existing CacheManager is: DefaultConfigurationSource [ ehcache.xml or ehcache-failsafe.xml ]at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772)at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839)at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538)at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:446)at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:328)at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5118)at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5634)at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899)at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:679)at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1966)at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)at java.util.concurrent.FutureTask.run(FutureTask.java:262)at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.cache.interceptor.CacheInterceptor#0': Cannot resolve reference to bean 'cacheManager' while setting bean property 'cacheManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cacheManager' defined in class path resource [spring.xml]: Cannot resolve reference to bean 'ehcache' while setting bean property 'cacheManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ehcache' defined in class path resource [spring.xml]: Invocation of init method failed; nested exception is net.sf.ehcache.CacheException: Another unnamed CacheManager already exists in the same VM. Please provide unique names for each CacheManager in the config or do one of following:
1. Use one of the CacheManager.create() static factory methods to reuse same CacheManager with same name or create one if necessary
2. Shutdown the earlier cacheManager before creating new one with same name.
The source of the existing CacheManager is: DefaultConfigurationSource [ ehcache.xml or ehcache-failsafe.xml ]at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:359)at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1481)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1226)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)at org.springframework.aop.support.AbstractBeanFactoryPointcutAdvisor.getAdvice(AbstractBeanFactoryPointcutAdvisor.java:88)at org.springframework.aop.support.AbstractPointcutAdvisor.getOrder(AbstractPointcutAdvisor.java:52)at org.springframework.core.OrderComparator.findOrder(OrderComparator.java:139)at org.springframework.core.annotation.AnnotationAwareOrderComparator.findOrder(AnnotationAwareOrderComparator.java:62)at org.springframework.core.OrderComparator.getOrder(OrderComparator.java:127)at org.springframework.core.OrderComparator.getOrder(OrderComparator.java:116)at org.springframework.core.OrderComparator.doCompare(OrderComparator.java:88)at org.springframework.core.OrderComparator.compare(OrderComparator.java:73)at java.util.TimSort.countRunAndMakeAscending(TimSort.java:324)at java.util.TimSort.sort(TimSort.java:189)at java.util.TimSort.sort(TimSort.java:173)at java.util.Arrays.sort(Arrays.java:659)at java.util.Collections.sort(Collections.java:217)at org.springframework.core.annotation.AnnotationAwareOrderComparator.sort(AnnotationAwareOrderComparator.java:116)at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.sortAdvisors(AbstractAdvisorAutoProxyCreator.java:145)at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findEligibleAdvisors(AbstractAdvisorAutoProxyCreator.java:91)at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.getAdvicesAndAdvisorsForBean(AbstractAdvisorAutoProxyCreator.java:69)at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:346)at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:298)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:422)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1583)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)... 24 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cacheManager' defined in class path resource [spring.xml]: Cannot resolve reference to bean 'ehcache' while setting bean property 'cacheManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ehcache' defined in class path resource [spring.xml]: Invocation of init method failed; nested exception is net.sf.ehcache.CacheException: Another unnamed CacheManager already exists in the same VM. Please provide unique names for each CacheManager in the config or do one of following:
1. Use one of the CacheManager.create() static factory methods to reuse same CacheManager with same name or create one if necessary
2. Shutdown the earlier cacheManager before creating new one with same name.
The source of the existing CacheManager is: DefaultConfigurationSource [ ehcache.xml or ehcache-failsafe.xml ]at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:359)at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1481)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1226)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351)... 55 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ehcache' defined in class path resource [spring.xml]: Invocation of init method failed; nested exception is net.sf.ehcache.CacheException: Another unnamed CacheManager already exists in the same VM. Please provide unique names for each CacheManager in the config or do one of following:
1. Use one of the CacheManager.create() static factory methods to reuse same CacheManager with same name or create one if necessary
2. Shutdown the earlier cacheManager before creating new one with same name.
The source of the existing CacheManager is: DefaultConfigurationSource [ ehcache.xml or ehcache-failsafe.xml ]at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351)... 65 more
Caused by: net.sf.ehcache.CacheException: Another unnamed CacheManager already exists in the same VM. Please provide unique names for each CacheManager in the config or do one of following:
1. Use one of the CacheManager.create() static factory methods to reuse same CacheManager with same name or create one if necessary
2. Shutdown the earlier cacheManager before creating new one with same name.
The source of the existing CacheManager is: DefaultConfigurationSource [ ehcache.xml or ehcache-failsafe.xml ]at net.sf.ehcache.CacheManager.assertNoCacheManagerExistsWithSameName(CacheManager.java:458)at net.sf.ehcache.CacheManager.init(CacheManager.java:355)at net.sf.ehcache.CacheManager.<init>(CacheManager.java:243)at org.springframework.cache.ehcache.EhCacheManagerFactoryBean.afterPropertiesSet(EhCacheManagerFactoryBean.java:157)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)... 72 more

 

 

  原因:ehcache2.5以上版本会报错。

  解决办法:将ehcache版本降到2.5以下即可。

 

转载于:https://www.cnblogs.com/qlqwjy/p/9630943.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/485117.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

科技议题“破圈”有利还是有弊|观点

编辑&#xff1a;赵路排版&#xff1a;郭刚作者&#xff1a;李侠最近几年时常出现科技议题进入社会领域并引起社会广泛关注的现象&#xff0c;学界通常将之称为“破圈”&#xff0c;即议题突破科技界原有的狭小圈子而进入更大的社会领域&#xff0c;并引来社会热议。客观地说&a…

【剑指offer】面试题32 - III:从上到下打印二叉树 III(Java)

请实现一个函数按照之字形顺序打印二叉树&#xff0c;即第一行按照从左到右的顺序打印&#xff0c;第二层按照从右到左的顺序打印&#xff0c;第三行再按照从左到右的顺序打印&#xff0c;其他行以此类推。 例如: 给定二叉树: [3,9,20,null,null,15,7], 3 / \ 9 20 /…

python---str和repr

在 Python 中要将某一类型的变量或者常量转换为字符串对象通常有两种方法&#xff0c;即 str() 或者 repr() 。 区别与使用 函数str() 用于将值转化为适于人阅读的形式&#xff0c;而repr() 转化为供解释器读取的形式&#xff08;如果没有等价的语法&#xff0c;则会发生Syntax…

学术研究发现英特尔 CPU 存在新漏洞

作者&#xff1a;Thomas Claburn译者&#xff1a;Sambodhi策划&#xff1a;施尧美国的芯片黑客又想出了一种方法&#xff0c;利用英特尔的处理器设计选择来窃取敏感数据。伊利诺伊大学香槟分校的博士生 Riccardo Paccagnella、硕士生 Licheng Luo 和助理教授 Christopher Fletc…

Leetcode--994. 腐烂的橘子(java)

在给定的网格中&#xff0c;每个单元格可以有以下三个值之一&#xff1a; 值 0 代表空单元格&#xff1b; 值 1 代表新鲜橘子&#xff1b; 值 2 代表腐烂的橘子。 每分钟&#xff0c;任何与腐烂的橘子&#xff08;在 4 个正方向上&#xff09;相邻的新鲜橘子都会腐烂。 返回直…

CICC科普栏目丨时间之箭:从熵到大爆炸再到万物理论(一)

来源&#xff1a;BBC转自&#xff1a;数学加油吧假设有这么一天&#xff0c;你在家里感到无聊&#xff0c;你把几个鸡蛋顶在头上表演起杂耍&#xff0c;但你的表演不太成功&#xff0c;鸡蛋打碎糊了你一脸。现在你将不得不去洗下脸再冲个澡&#xff0c;然后换上一身新衣服。那为…

NOIP2007 树网的核

传送门 最近搞一搞树型结构……毕竟自己树的知识学的太垃圾了。 首先这道题非常明显要求树的直径。树的直径有好多好多种求法&#xff0c;这里我选择了一位dalao的非常简洁的dfs的方法。先看一下代码。 void dfs(int x) {for(int i head[x];i;i e[i].next){if(fa[x] e[i].to…

只有这种AI芯片才能拯救人工智能?

来源&#xff1a;内容由半导体行业观察&#xff08;ID&#xff1a;icbank&#xff09;编译&#xff1a;「wired」人工智能不断发展&#xff0c;对保持AI运行所需的计算能力的渴望也与日俱增。Lightmatter&#xff0c;一家诞生于MIT的初创公司&#xff0c;他们正在押注一款使用光…

【剑指offer】面试题33:二叉搜索树的后序遍历序列(Java)

输入一个整数数组&#xff0c;判断该数组是不是某二叉搜索树的后序遍历结果。如果是则返回 true&#xff0c;否则返回 false。假设输入的数组的任意两个数字都互不相同。 参考以下这颗二叉搜索树&#xff1a; 5 / \ 2 6 / \ 1 3 示例 1&#xff1a; 输入: [1,6,…

CSS 小结笔记之文字溢出处理

有时文字会溢出盒子&#xff0c;这时一般要对文字进行溢出处理。一般有以下三种处理方法&#xff1a; 1、word-break:normal | break-all |keep-all normal 使用浏览器默认的换行 break-all 允许单词内换行即允许单词拆开显示 keep-all 不允许拆开单词显示&#xff0c;连字符除…

GPT-2大战GPT-3:OpenAI内部的一场终极对决

作者&#xff1a;Kevin Vu译者&#xff1a;Sambodhi策划&#xff1a;刘燕由于在训练过程中使用的数据集的多样性&#xff0c;我们可以为来自不同领域的文本获得足够的文本生成。GPT-2 的参数和数据是其前代 GPT 的 10 倍。而 GPT-3 又是 GPT-2 的 10 倍。那么问题来了&#xff…

【剑指offer】面试题34:二叉树中和为某一值的路径(Java)

输入一棵二叉树和一个整数&#xff0c;打印出二叉树中节点值的和为输入整数的所有路径。从树的根节点开始往下一直到叶节点所经过的节点形成一条路径。 示例: 给定如下二叉树&#xff0c;以及目标和 sum 22&#xff0c; 5 / \ 4 8 / …

AI解梦成为现实,贝尔实验室新算法尝试找到梦境的隐藏含义

文章来源&#xff1a; 学术头条古代巴比伦人认为梦境包含了预言&#xff0c;而古埃及人则将梦境视为神灵给予的信息来崇拜。在 19 世纪 90 年代&#xff0c;西格蒙德弗洛伊德&#xff08;Sigmund Freud&#xff09;为梦境里面的人物、物体和场景分配了象征意义&#xff0c;并着…

个人项目:wc程序(java)

Github项目地址&#xff1a;https://github.com/jat0824/wc.git 项目相关要求 wc.exe 是一个常见的工具&#xff0c;它能统计文本文件的字符数、单词数和行数。这个项目要求写一个命令行程序&#xff0c;模仿已有wc.exe 的功能&#xff0c;并加以扩充&#xff0c;给出某程序设计…

【剑指offer】面试题35:复杂链表的复制(Java)

请实现 copyRandomList 函数&#xff0c;复制一个复杂链表。在复杂链表中&#xff0c;每个节点除了有一个 next 指针指向下一个节点&#xff0c;还有一个 random 指针指向链表中的任意节点或者 null。 示例 1&#xff1a; 输入&#xff1a;head [[7,null],[13,0],[11,4],[10,2…

【综述专栏】图神经网络综述

来源&#xff1a;图灵人工智能作者&#xff1a;王健宗等https://wwwihcm/people/euu-lin-jun-7原文链接&#xff1a;https://kns.cnki.net/kcms/detail/31.1289.tp.20201123.1641.002.html摘要&#xff1a;随着计算机行业和互联网时代的不断发展与进步&#xff0c;图神经网络已…

HDFS设计思想

HDFS设计思想 DataNode&#xff1a;用来在磁盘上存储数据 HDFS 数据存储单元&#xff08; block &#xff09; 1 文件被切分成固定大小的数据block块 •默认数据块大小为 64MB(hadoop1.x版本64M&#xff0c;2.x为128M) &#xff0c;可配置 •若文件大小不到 64MB &#xff…

【剑指offer】面试题25:合并两个排序的链表(Java)

输入两个递增排序的链表&#xff0c;合并这两个链表并使新链表中的节点仍然是递增排序的。 示例1&#xff1a; 输入&#xff1a;1->2->4, 1->3->4 输出&#xff1a;1->1->2->3->4->4 限制&#xff1a; 0 < 链表长度 < 1000 代码&#xff…

被认为是世界史上50个最伟大的发明有哪些?

来源&#xff1a;数学中国根据美国《大西洋月刊》杂志邀请了世界上12位科学家、技术史专家、工程师、企业高管组成的专家团为世界遴选自车轮&#xff08;车轮的广泛使用一般被认为始于6000年前&#xff09;问世后的50个最伟大的发明。其中&#xff0c;中国的四大发明均在其中。…

numpy中的tile函数

在阅读《机器学习实战》一书中&#xff0c;第一次碰见tile函数一脸懵逼&#xff0c;试验了几次之后&#xff0c;明白了怎么回事&#xff0c;记录如下&#xff1a; >>> import numpy >>> numpy.tile([0,0],5)#在列方向上重复[0,0]5次&#xff0c;默认行1次 ar…