异常如下:
Caused by: java.lang.NoSuchMethodError: net.sf.ehcache.Cache.<init>(Ljava/lang/String;ILnet/sf/ehcache/store/MemoryStoreEvictionPolicy;ZLjava/lang/String;ZJJZJLnet/sf/ehcache/event/RegisteredEventListeners;Lnet/sf/ehcache/bootstrap/BootstrapCacheLoader;II)V
at org.springframework.cache.ehcache.EhCacheFactoryBean.createCache(EhCacheFactoryBean.java:354)
at org.springframework.cache.ehcache.EhCacheFactoryBean.afterPropertiesSet(EhCacheFactoryBean.java:331)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
... 38 more
原因可能是ehcache的包版本不对,但是pom.xml中确实是正确的版本,应该是eclipse运行junit时用的是另一个版本的包。
可以这样解决:
Run -> Debug Configurations... -> 选中你的junit任务 -> Classpath -> Bootstrap Entries中增加正确的jar包。如图
- 大小: 76.8 KB
分享到:
相关推荐
在Eclipse中使用JUnit4进行单元测试!
使用Eclipse进行Junit测试,junit类的创建
eclipse下利用ant、junit进行自动化测试例子源码
Eclipse自动生成接口和JUnit测试类 Eclipse自动生成接口和JUnit测试类 Eclipse自动生成接口和JUnit测试类
在Eclipse中使用JUnit4进行单元测试 在Eclipse中使用JUnit4进行单元测试
dos命令测试java jar文件 命令行下运行JUnit测试 命令运行java
Eclipse下Junit的详细配置,图文 + 实例
Eclipse中使用Junit插件测试
如何在eclipse中使用junit4进行单体测试的说明教程
eclipse使用和junit使用
junit部署环境 博文链接:https://zhouyunjian.iteye.com/blog/2326046
通过在Eclipse中使用junit进行单元测试,可以进行快速的测试
eclipse中junit测试实例,有文档和源码
junit测试 test txt file
NULL 博文链接:https://seaizon.iteye.com/blog/752650
Eclipse自动生成接口和JUnit测试类
junit测试测试junit测试测试junit测试测试junit测试测试
jUnit4入门好帮手,有详细介绍和完整的代码示例
Eclipse中使用JUnit