启动单元测试时,发现报错如下:

java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: java.lang.IllegalStateException: Unable to load cache item

启动容器失败。

Initialization of bean failed; nested exception is org.springframework.aop.framework.AopConfigException: Unexpected AOP exception; nested exception is java.lang.IllegalStateException: Unable to load cache item

一开始我以为是循环引用引起的错误,debug发现并不是。

开启 debug日志 报

Caused by: java.lang.VerifyError: Stack map does not match the one at exception handler 9

这种是jvm验证时出了错误:说是字节码错误:
搜索了一下,网上的解释是因为使用了java的新特性,所以使用较高的版本进行编译时就会报这个错。

对于java7而言,需要添加-XX:-UseSplitVerifier虚拟机参数。
对于java8而言,需要添加-noverify虚拟机参数。

Logo

技术共进,成长同行——讯飞AI开发者社区

更多推荐