1. 程式人生 > >spring4 與 activeMQ 5.14以上版本衝突

spring4 與 activeMQ 5.14以上版本衝突

當Spring4 與 activeMQ5.14以上版本jar包同時匯入時會發生錯誤:
ERROR | Context initialization failed
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;
       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1572)
       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
       at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
       at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
       at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
       at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
       at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:755)
       at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:762)
       at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
       at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:666)
       at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:632)
       at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:680)
       at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:551)
       at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:492)
       at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
       at javax.servlet.GenericServlet.init(GenericServlet.java:158)
       at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1227)
       at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1140)
       at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1027)
       at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5038)
       at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5348)
       at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
       at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)
       at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
       at java.util.concurrent.FutureTask.run(FutureTask.java:266)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
       at java.lang.Thread.run(Thread.java:748)




原因是 :activeMQ5.14以上版本中集成了spring一些包,導致衝突。 解決方法:使用activeMQ5.11.1及以下版本即可。