缓存ehcache启动失败missing element type
启动失败了,报了如下错误:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ehCacheCacheManager' defined in class path resource [org/springframework/boot/autoconfigure/cache/EhCacheCacheConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [net.sf.ehcache.CacheManager]: Factory method 'ehCacheCacheManager' threw exception; nested exception is net.sf.ehcache.CacheException: java.lang.annotation.IncompleteAnnotationException: org.terracotta.statistics.Statistic missing element type
以前一直在用,没有问题,新项目报错。
新项目唯一不同的是尝试了easyexcel,我好像知道些什么了。
查看easyexcel的pom.xml,找到了这个。
<dependency> <groupId>org.ehcache</groupId> <artifactId>ehcache</artifactId> <version>3.4.0</version> </dependency>
基本上定位问题所在了,org.ehcache和net.sf.ehcache有冲突,那么既然easyexcel已经引用了,我们就去掉net.sf.ehcache。
然后依然报错,有了新的提示,告诉我们无法连接redis,懂了。
那么我们尝试一下用net.sf.ehcache,排除org.ehcache。
<dependency> <groupId>com.alibaba</groupId> <artifactId>easyexcel</artifactId> <version>2.2.3</version> <exclusions> <exclusion> <groupId>org.ehcache</groupId> <artifactId>ehcache</artifactId> </exclusion> </exclusions> </dependency>
启动成功了。
吐槽:阿里的开源框架原来代码写得这么坑。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?