java web maven 项目使用dwr,启动项目报错java.lang.NoSuchMethodError

来源:互联网 发布:mac客户端的网游 编辑:程序博客网 时间:2024/06/08 07:04

错误信息为:

java.lang.NoSuchMethodError: org.springframework.beans.factory.annotation.InjectionMetadata.needsRefresh(Lorg/springframework/beans/factory/annotation/InjectionMetadata;Ljava/lang/Class;)Z    at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findPersistenceMetadata(PersistenceAnnotationBeanPostProcessor.java:384)    at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(PersistenceAnnotationBeanPostProcessor.java:333)    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:846)    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:498)    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461)    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198)    at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:741)    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389)    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294)    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4797)    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5291)    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)    at java.util.concurrent.FutureTask.run(FutureTask.java:262)    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)    at java.lang.Thread.run(Thread.java:745)十月 11, 2017 10:22:42 下午 org.apache.catalina.core.StandardContext listenerStart严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListenerjava.lang.NoSuchMethodError: org.springframework.beans.factory.annotation.InjectionMetadata.needsRefresh(Lorg/springframework/beans/factory/annotation/InjectionMetadata;Ljava/lang/Class;)Z    at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findPersistenceMetadata(PersistenceAnnotationBeanPostProcessor.java:384)    at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(PersistenceAnnotationBeanPostProcessor.java:333)    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:846)    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:498)    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461)    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198)    at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:741)    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389)    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294)    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4797)    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5291)    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)    at java.util.concurrent.FutureTask.run(FutureTask.java:262)    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)    at java.lang.Thread.run(Thread.java:745)十月 11, 2017 10:22:42 下午 org.apache.catalina.core.StandardContext startInternal严重: Error listenerStart十月 11, 2017 10:22:42 下午 org.apache.catalina.core.StandardContext startInternal严重: Context [/bbs] startup failed due to previous errors十月 11, 2017 10:22:42 下午 org.apache.catalina.core.ApplicationContext log信息: Closing Spring root WebApplicationContext2017-10-11 22:22:42,381 WARN [org.springframework.web.context.support.XmlWebApplicationContext] - Exception thrown from ApplicationListener handling ContextClosedEventjava.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: Root WebApplicationContext: startup date [Wed Oct 11 22:22:38 CST 2017]; root of context hierarchy    at org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:347)    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334)    at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1049)    at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:1010)    at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:558)    at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:143)    at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4837)    at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5483)    at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:160)    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)    at java.util.concurrent.FutureTask.run(FutureTask.java:262)    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)    at java.lang.Thread.run(Thread.java:745)2017-10-11 22:22:42,381 WARN [org.springframework.web.context.support.XmlWebApplicationContext] - Exception thrown from LifecycleProcessor on context closejava.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: Root WebApplicationContext: startup date [Wed Oct 11 22:22:38 CST 2017]; root of context hierarchy    at org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:360)    at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1057)    at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:1010)    at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:558)    at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:143)    at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4837)    at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5483)    at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:160)    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)    at java.util.concurrent.FutureTask.run(FutureTask.java:262)    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)    at java.lang.Thread.run(Thread.java:745)

可以看到,第一行:

org.springframework.beans.factory.annotation.InjectionMetadata.needsRefresh(Lorg/springframework/beans/factory/annotation/InjectionMetadata;Ljava/lang/Class;)Z

根据路径找到:org.springframework.beans.factory.annotation.InjectioMetadata类没有needsRefresh方法,进去一看,果真没有此方法。
然后我就想这个版本没有此方法,应该在高版本中会有,所以我把pom.xml的spring版本从3.2.2.RELEASE改到了4.0.2.RELEASE,然后重新启动项目,错误消失。

阅读全文
0 0
原创粉丝点击