java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext

Spring JIRA | Grant Gochnauer | 7 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

    [SPR-6520] Upgrading from Sping 2.5.6 to 3.0RC3 on WAS 6.1 with an ear.context results in a startup exception - Spring JIRA

    spring.io | 1 year ago
    java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
  2. 0

    My web.xml has: <context-param> <param-name>parentContextKey</param-name> <param-value>ear.context</param-value> </context-param> java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext at org.springframework.context.support.AbstractRefreshableApplicationContext.getBeanFactory(AbstractRefreshableApplicationContext.java:171) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1008) at org.springframework.beans.factory.access.SingletonBeanFactoryLocator.useBeanFactory(SingletonBeanFactoryLocator.java:397) at org.springframework.web.context.ContextLoader.loadParentContext(ContextLoader.java:343) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:188) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47) at com.ibm.ws.wswebcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:653) at com.ibm.ws.webcontainer.webapp.WebApp.commonInitializationFinish(WebApp.java:370) at com.ibm.ws.wswebcontainer.webapp.WebApp.initialize(WebApp.java:293) at com.ibm.ws.wswebcontainer.webapp.WebGroup.addWebApplication(WebGroup.java:93) at com.ibm.ws.wswebcontainer.VirtualHost.addWebApplication(VirtualHost.java:162) at com.ibm.ws.wswebcontainer.WebContainer.addWebApp(WebContainer.java:673) at com.ibm.ws.wswebcontainer.WebContainer.addWebApplication(WebContainer.java:626) at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:335) at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:551)

    Spring JIRA | 7 years ago | Grant Gochnauer
    java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
  3. 0

    My web.xml has: <context-param> <param-name>parentContextKey</param-name> <param-value>ear.context</param-value> </context-param> java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext at org.springframework.context.support.AbstractRefreshableApplicationContext.getBeanFactory(AbstractRefreshableApplicationContext.java:171) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1008) at org.springframework.beans.factory.access.SingletonBeanFactoryLocator.useBeanFactory(SingletonBeanFactoryLocator.java:397) at org.springframework.web.context.ContextLoader.loadParentContext(ContextLoader.java:343) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:188) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47) at com.ibm.ws.wswebcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:653) at com.ibm.ws.webcontainer.webapp.WebApp.commonInitializationFinish(WebApp.java:370) at com.ibm.ws.wswebcontainer.webapp.WebApp.initialize(WebApp.java:293) at com.ibm.ws.wswebcontainer.webapp.WebGroup.addWebApplication(WebGroup.java:93) at com.ibm.ws.wswebcontainer.VirtualHost.addWebApplication(VirtualHost.java:162) at com.ibm.ws.wswebcontainer.WebContainer.addWebApp(WebContainer.java:673) at com.ibm.ws.wswebcontainer.WebContainer.addWebApplication(WebContainer.java:626) at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:335) at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:551)

    Spring JIRA | 7 years ago | Grant Gochnauer
    java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    [SPR-4301] Initializing shared context from within an EJB and sharing it with a web module - Spring JIRA

    spring.io | 1 year ago
    java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
  6. 0

    DROID doesn't clean up BeanFactory state after run?

    GitHub | 4 years ago | mistydemeo
    java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext

  1. kjhdofjosvs 236 times, last 2 months ago
  2. Conscript 1 times, last 9 months ago
16 unregistered visitors
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

    BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext

    at org.springframework.context.support.AbstractRefreshableApplicationContext.getBeanFactory()
  2. Spring Context
    AbstractApplicationContext.getBean
    1. org.springframework.context.support.AbstractRefreshableApplicationContext.getBeanFactory(AbstractRefreshableApplicationContext.java:171)
    2. org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1008)
    2 frames
  3. Spring Beans
    SingletonBeanFactoryLocator.useBeanFactory
    1. org.springframework.beans.factory.access.SingletonBeanFactoryLocator.useBeanFactory(SingletonBeanFactoryLocator.java:397)
    1 frame
  4. Spring
    ContextLoaderListener.contextInitialized
    1. org.springframework.web.context.ContextLoader.loadParentContext(ContextLoader.java:343)
    2. org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:188)
    3. org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
    3 frames
  5. com.ibm.ws
    WebApp.notifyServletContextCreated
    1. com.ibm.ws.wswebcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:653)
    1 frame
  6. WebSphere
    WebApp.commonInitializationFinish
    1. com.ibm.ws.webcontainer.webapp.WebApp.commonInitializationFinish(WebApp.java:370)
    1 frame
  7. com.ibm.ws
    WebContainer.addWebApplication
    1. com.ibm.ws.wswebcontainer.webapp.WebApp.initialize(WebApp.java:293)
    2. com.ibm.ws.wswebcontainer.webapp.WebGroup.addWebApplication(WebGroup.java:93)
    3. com.ibm.ws.wswebcontainer.VirtualHost.addWebApplication(VirtualHost.java:162)
    4. com.ibm.ws.wswebcontainer.WebContainer.addWebApp(WebContainer.java:673)
    5. com.ibm.ws.wswebcontainer.WebContainer.addWebApplication(WebContainer.java:626)
    5 frames
  8. WebSphere
    WebContainerImpl.start
    1. com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:335)
    2. com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:551)
    2 frames