java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: Root WebApplicationContext: startup date [Thu Nov 15 17:27:08 CST 2012]; root of context hierarchy

Spring JIRA | Archie Cobbs | 4 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    My application had a bug causing an exception to be thrown during construction of a bean. This caused the application context refresh operation to be aborted. However, in the process of aborting the refresh, an additional exception was thrown by {{AbstractApplicationContext.getLifecycleProcessor()}}. This second exception got logged to the error log, but the first exception never did. As a result, it was very difficult to debug what the actual problem was. The error logs, including the second exception that did get logged, are here (edited for brevity): {noformat} 2012-11-15 17:27:29,067 [localhost-startStop-1] INFO : Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@7dbafc22: defining beans [...]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@5697c78b 2012-11-15 17:27:29,551 [localhost-startStop-1] INFO : Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@7dbafc22: defining beans [...]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@5697c78b 2012-11-15 17:27:29,595 [localhost-startStop-1] INFO : Closing Root WebApplicationContext: startup date [Thu Nov 15 17:27:08 CST 2012]; root of context hierarchy 2012-11-15 17:27:29,607 [localhost-startStop-1] WARN : 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 [Thu Nov 15 17:27:08 CST 2012]; root of context hierarchy at org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:350) at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1038) at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:993) at org.springframework.context.support.AbstractApplicationContext.destroy(AbstractApplicationContext.java:981) at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:211) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:498) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:474) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:509) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:474) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:300) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:609) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:469) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:383) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4791) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5285) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:618) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1100) at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1618) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) at java.lang.Thread.run(Thread.java:722) {noformat} It appears that the following snippet of code in {{AbstractBeanFactory}} (visible in the above stack trace) may be contributing to the problem (but I haven't verified that for sure). Note how the second exception occurs during the call to {{destroySingleton()}}. {noformat} // Create bean instance. if (mbd.isSingleton()) { sharedInstance = getSingleton(beanName, new ObjectFactory<Object>() { public Object getObject() throws BeansException { try { return createBean(beanName, mbd, args); } catch (BeansException ex) { // Explicitly remove instance from singleton cache: It might have been put there // eagerly by the creation process, to allow for circular reference resolution. // Also remove any beans that received a temporary reference to the bean. destroySingleton(beanName); throw ex; } } }); bean = getObjectForBeanInstance(sharedInstance, name, beanName, mbd); } {noformat} Possibly relevant: I have a slightly unusual setup where an outer application context contains a bean which is itself an inner application context: {noformat} <bean id="updatesContext" class="org.springframework.context.support.ClassPathXmlApplicationContext"> <constructor-arg> <util:list> <value>classpath:updates.xml</value> </util:list> </constructor-arg> <constructor-arg> <value>false</value> </constructor-arg> <constructor-arg> <bean factory-bean="applicationContextBean" factory-method="getApplicationContext"/> </constructor-arg> </bean> {noformat} The {{applicationContextBean}} is a bean that exposes the containing application context. It is set as the parent of the nested context. Note the {{refresh}} constructor parameter is {{false}}, so the inner application context is not refreshed until {{afterPropertiesSet()}}. Bottom line: ideally, secondary exceptions should never occur; but if they do, they should never prevent a primary exception from being logged.

    Spring JIRA | 4 years ago | Archie Cobbs
    java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: Root WebApplicationContext: startup date [Thu Nov 15 17:27:08 CST 2012]; root of context hierarchy
  2. 0

    My application had a bug causing an exception to be thrown during construction of a bean. This caused the application context refresh operation to be aborted. However, in the process of aborting the refresh, an additional exception was thrown by {{AbstractApplicationContext.getLifecycleProcessor()}}. This second exception got logged to the error log, but the first exception never did. As a result, it was very difficult to debug what the actual problem was. The error logs, including the second exception that did get logged, are here (edited for brevity): {noformat} 2012-11-15 17:27:29,067 [localhost-startStop-1] INFO : Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@7dbafc22: defining beans [...]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@5697c78b 2012-11-15 17:27:29,551 [localhost-startStop-1] INFO : Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@7dbafc22: defining beans [...]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@5697c78b 2012-11-15 17:27:29,595 [localhost-startStop-1] INFO : Closing Root WebApplicationContext: startup date [Thu Nov 15 17:27:08 CST 2012]; root of context hierarchy 2012-11-15 17:27:29,607 [localhost-startStop-1] WARN : 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 [Thu Nov 15 17:27:08 CST 2012]; root of context hierarchy at org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:350) at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1038) at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:993) at org.springframework.context.support.AbstractApplicationContext.destroy(AbstractApplicationContext.java:981) at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:211) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:498) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:474) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:509) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:474) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:300) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:609) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:469) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:383) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4791) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5285) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:618) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1100) at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1618) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) at java.lang.Thread.run(Thread.java:722) {noformat} It appears that the following snippet of code in {{AbstractBeanFactory}} (visible in the above stack trace) may be contributing to the problem (but I haven't verified that for sure). Note how the second exception occurs during the call to {{destroySingleton()}}. {noformat} // Create bean instance. if (mbd.isSingleton()) { sharedInstance = getSingleton(beanName, new ObjectFactory<Object>() { public Object getObject() throws BeansException { try { return createBean(beanName, mbd, args); } catch (BeansException ex) { // Explicitly remove instance from singleton cache: It might have been put there // eagerly by the creation process, to allow for circular reference resolution. // Also remove any beans that received a temporary reference to the bean. destroySingleton(beanName); throw ex; } } }); bean = getObjectForBeanInstance(sharedInstance, name, beanName, mbd); } {noformat} Possibly relevant: I have a slightly unusual setup where an outer application context contains a bean which is itself an inner application context: {noformat} <bean id="updatesContext" class="org.springframework.context.support.ClassPathXmlApplicationContext"> <constructor-arg> <util:list> <value>classpath:updates.xml</value> </util:list> </constructor-arg> <constructor-arg> <value>false</value> </constructor-arg> <constructor-arg> <bean factory-bean="applicationContextBean" factory-method="getApplicationContext"/> </constructor-arg> </bean> {noformat} The {{applicationContextBean}} is a bean that exposes the containing application context. It is set as the parent of the nested context. Note the {{refresh}} constructor parameter is {{false}}, so the inner application context is not refreshed until {{afterPropertiesSet()}}. Bottom line: ideally, secondary exceptions should never occur; but if they do, they should never prevent a primary exception from being logged.

    Spring JIRA | 4 years ago | Archie Cobbs
    java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: Root WebApplicationContext: startup date [Thu Nov 15 17:27:08 CST 2012]; root of context hierarchy
  3. 0

    ServiceMix - User - java.lang.IllegalArgumentException: argument type mismatch... WHEN DEPLOYING SIMPLE Service Assembly with servicemix-bean

    nabble.com | 1 year ago
    java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: org.apache.xbean.spring.context.FileSystemXmlApplicationContext@ef9712: startup date [Fri Apr 06 10:29:51 EDT 2012]; root of context hierarchy
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    ServiceMix - User - mail marshaller deployment problems

    nabble.com | 2 years ago
    java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: org.apache.xbean.spring.context.FileSystemXmlApplicationContex t@1533b2c: display name [org.apache.xbean.spring.context.FileSystemXmlApplicationContext@1533b2c]; startup date [Mon Jun 28 10:43:16 CEST 2010]; root of context hierarchy
  6. 0

    ServiceMix - Dev - Error Deploying Camel JMS service unit

    nabble.com | 1 year ago
    java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: org.apache.xbean.spring.context.FileSystemXmlApplicationContext@720e6c33: startup date [Thu Dec 22 11:34:47 CET 2011]; root of context hierarchy

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.IllegalStateException

      LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: Root WebApplicationContext: startup date [Thu Nov 15 17:27:08 CST 2012]; root of context hierarchy

      at org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor()
    2. Spring Context
      AbstractApplicationContext.destroy
      1. org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:350)
      2. org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1038)
      3. org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:993)
      4. org.springframework.context.support.AbstractApplicationContext.destroy(AbstractApplicationContext.java:981)
      4 frames
    3. Spring Beans
      DefaultListableBeanFactory.preInstantiateSingletons
      1. org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:211)
      2. org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:498)
      3. org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:474)
      4. org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:509)
      5. org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:474)
      6. org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:300)
      7. org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
      8. org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
      9. org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
      10. org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:609)
      10 frames
    4. Spring Context
      AbstractApplicationContext.refresh
      1. org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
      2. org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:469)
      2 frames
    5. Spring
      ContextLoaderListener.contextInitialized
      1. org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:383)
      2. org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283)
      3. org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
      3 frames
    6. Glassfish Core
      HostConfig$DeployDirectory.run
      1. org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4791)
      2. org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5285)
      3. org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      4. org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
      5. org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
      6. org.apache.catalina.core.StandardHost.addChild(StandardHost.java:618)
      7. org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1100)
      8. org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1618)
      8 frames
    7. Java RT
      Thread.run
      1. java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
      2. java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
      3. java.util.concurrent.FutureTask.run(FutureTask.java:166)
      4. java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
      5. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
      6. java.lang.Thread.run(Thread.java:722)
      6 frames