分布式网上商城项目-消息队列使用错误

 

NoSuchMethodError错误

 

 1 2018-06-11 22:41:04,387 [localhost-startStop-1] [org.springframework.web.context.support.XmlWebApplicationContext]-[WARN] Exception encountered during context initialization - cancelling refresh attempt
 2 
 3 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping': Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.springframework.core.annotation.AnnotatedElementUtils.findMergedAnnotation(Ljava/lang/reflect/AnnotatedElement;Ljava/lang/Class;)Ljava/lang/annotation/Annotation;
 4 
 5          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1572)
 6 
 7          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
 8 
 9          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
10 
11          at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
12 
13          at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
14 
15          at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
16 
17          at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
18 
19          at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:755)
20 
21          at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:759)
22 
23          at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
24 
25          at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:668)
26 
27          at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:634)
28 
29          at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:682)
30 
31          at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:553)
32 
33          at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:494)
34 
35          at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
36 
37          at javax.servlet.GenericServlet.init(GenericServlet.java:160)
38 
39          at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1280)
40 
41          at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1193)
42 
43          at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1088)
44 
45          at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5176)
46 
47          at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5460)
48 
49          at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
50 
51          at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
52 
53          at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
54 
55          at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
56 
57          at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135)
58 
59          at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
60 
61          at java.base/java.lang.Thread.run(Thread.java:844)
62 
63 Caused by: java.lang.NoSuchMethodError: org.springframework.core.annotation.AnnotatedElementUtils.findMergedAnnotation(Ljava/lang/reflect/AnnotatedElement;Ljava/lang/Class;)Ljava/lang/annotation/Annotation;
64 
65          at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.createRequestMappingInfo(RequestMappingHandlerMapping.java:203)
66 
67          at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.getMappingForMethod(RequestMappingHandlerMapping.java:185)
68 
69          at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.getMappingForMethod(RequestMappingHandlerMapping.java:53)
70 
71          at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping$1.inspect(AbstractHandlerMethodMapping.java:218)
72 
73          at org.springframework.core.MethodIntrospector$1.doWith(MethodIntrospector.java:72)
74 
75          at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:495)
76 
77          at org.springframework.core.MethodIntrospector.selectMethods(MethodIntrospector.java:68)
78 
79          at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.detectHandlerMethods(AbstractHandlerMethodMapping.java:214)
80 
81          at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.initHandlerMethods(AbstractHandlerMethodMapping.java:191)
82 
83          at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.afterPropertiesSet(AbstractHandlerMethodMapping.java:161)
84 
85          at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.afterPropertiesSet(RequestMappingHandlerMapping.java:125)
86 
87          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1631)
88 
89          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1568)
90 
91          ... 28 more

 


findMergedAnnotation发生错误,检查activemq-all的源码发现在activemq-all中已经有了spring的依赖,依赖冲突从而无法初始化,报错是因为org.springframework.core.annotation.AnnotatedElementUtils.

 分布式网上商城项目-消息队列使用错误_第1张图片

5.12.0开始以后的版本jar包中包含了spring,与当前引入的spring冲突,于是将activemq-all版本修改为5.2.0,运行成功

转载于:https://www.cnblogs.com/thyHome/p/9170888.html

你可能感兴趣的:(java,测试)