org.springframework.core.annotation.AnnotationUtils.isCandidateClass(Ljava/lang/Class;Ljava/lang/Cla
问题描述:
写一个activemq的小栗子的时候,出现报错
Initialization of bean failed; nested exception is java.lang.NoSuchMethodError: org.springframework.core.annotation.AnnotationUtils.isCandidateClass(Ljava/lang/Class;Ljava/lang/Class;)Z
分析问题:
jar包冲突啦
IDEA按住shift+shift

看吧,这两个冲突啦。
是activmq-all-5.15.6.jar跟spring-core-5.2.7.RELEASE.jar
反编译看啦一下,AnnotationUtils真的冲突啦

解决办法:
就不要用activmq-all-5.15.6.jar包
删啦pom文件里的这个依赖
<!--<dependency>-->
<!--<groupId>org.apache.activemq</groupId>-->
<!--<artifactId>activemq-all</artifactId>-->
<!--<version>5.15.6</version>-->
<!--</dependency>-->
删啦相继出现啦这几个错误,都是提示缺包的
import org.springframework.stereotype.Service;
import org.apache.activemq.transport.stomp.StompConnection;
java.lang.NoClassDefFoundError: javax/jms/JMSContext
<!--activemq-all的替换包-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>5.2.7.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.2.5.RELEASE</version>
</dependency>
<dependency>
<groupId>activemq</groupId>
<artifactId>activemq-spring</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-stomp</artifactId>
<version>5.15.13</version>
</dependency>
然后就不报错成功啦~真开心鸭!
反正思路就是删了activmq-all-5.15.6.jar,代码里提示缺哪个就补哪个,就不冲突啦~
又是努力学习的一天,好充实好幸福~~~
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐


所有评论(0)