欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

java.lang.IllegalStateException: ApplicationEventMulticaster not initialized

程序员文章站 2022-07-12 16:56:35
...
[11-15 11:34:44][localhost-startStop-1][WARN ][AbstractApplicationContext.java-1052]-Exception thrown from ApplicationListener handling ContextClosedEvent  
java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: Root WebApplicationContext: startup date [Tue Nov 15 11:34:41 CST 2016]; 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:4774)  
    at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5411)  
    at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:226)  
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)  
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1404)  
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1394)  
    at java.util.concurrent.FutureTask.run(Unknown Source)  
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)  
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)  
    at java.lang.Thread.run(Unknown Source)  
[11-15 11:34:44][localhost-startStop-1][WARN ][AbstractApplicationContext.java-1060]-Exception thrown from LifecycleProcessor on context close  
java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: Root WebApplicationContext: startup date [Tue Nov 15 11:34:41 CST 2016]; 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:4774)  
    at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5411)  
    at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:226)  
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)  
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1404)  
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1394)  
    at java.util.concurrent.FutureTask.run(Unknown Source)  
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)  
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)  
    at java.lang.Thread.run(Unknown Source)  

 解决办法:
1.首先确认工程中spring的jar包是否引好了;
2.clean工程和tomcat(可以百度到不少说clean一下tomcat的,但是只是clean的话基本是没用的)确认不是原来发布过的工程影响;
3.检查tomcat的JDK版本和工程的JDK版本是否一致(我的就是这个原因,项目是1.7的,tomcat用的1.8的),修改tomcat的JDK版本后clean。

相关标签: IllegalStateException