异常解决:Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener

一、异常如下

控制台日志:

严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file [D:\IDEA\IDEAProject\SSSPcrud\out\artifacts\SSSPcrud_war_exploded\WEB-INF\classes\com\Ivey\sssp\controller\EmployeeController.class]; nested exception is java.lang.IncompatibleClassChangeError: class org.springframework.core.type.classreading.ClassMetadataReadingVisitor has interface org.springframework.asm.ClassVisitor as super class

……

Caused by: java.lang.IncompatibleClassChangeError: class org.springframework.core.type.classreading.ClassMetadataReadingVisitor has interface org.springframework.asm.ClassVisitor as super class

二、解决方案

能够很明显看出,翻译一下是不兼容的类转换引起的异常,是 jar 包冲突

原先,没有显式引入 spring-aop 依赖,只是引入了 spring-aspects 4.0.0版本的依赖,但是在引入 spring-data-jpa 后,就自动将 spring-aop 4.0.0 的版本改为 spring-aop 3.1.4,然后就出现了这个异常。

解决很简单,显式引入 spring-aop,将它的版本控制为和其它 spring 组件版本一致就可以了。

posted @ 2019-11-12 17:04  辰凩風  阅读(3060)  评论(0编辑  收藏  举报