java.lang.IllegalStateException

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


Samebug tips2

Execute mvn dependency:tree from your project's root directory.

The application is unable to connect to the database. It could be resolved by configuring access privileges on the database side.

Don't give up yet. Our experts can help. Paste your full stack trace to get a solution.


Solutions on the web26680

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

Solution icon of github
via GitHub by anfe0690
, 3 months ago
BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext

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

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

Solution icon of googlegroups
via Google Groups by Emil Hedenberg, 2 months ago
BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext

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

Solution icon of googlegroups
via Google Groups by Satya Reddy, 2 weeks ago
BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext

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

Solution icon of apache
via Apache's JIRA Issue Tracker by Andrew Onischuk, 3 months ago
BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext

Solution icon of pentaho
via Pentaho BI Platform Tracking by Emanuel Teixeira, 1 year ago
BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext

Stack trace

  • java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the at org.springframework.context.support.AbstractRefreshableApplicationContext.getBeanFactory(AbstractRefreshableApplicationContext.java:172) at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1066) at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1040) at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:988) at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:556) at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:142) at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4763) at org.apache.catalina.core.StandardContext$4.run(StandardContext.java:5472) at java.lang.Thread.run(Unknown Source) at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5481) at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:225) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1033) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:774) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1033) at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:291) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:727) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) at org.apache.catalina.startup.Catalina.start(Catalina.java:620) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:303) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:431)

Write tip

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

Users with the same issue

Samebug visitor profile picture
Unknown user
Once, 11 months ago
Samebug visitor profile picture
Unknown user
Once, 1 year ago
Samebug visitor profile picture
Unknown user
Once, 1 year ago
Samebug visitor profile picture
Unknown user
Once, 2 years ago
Samebug visitor profile picture
Unknown user
Once, 4 days ago
160 more bugmates