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

Searched on Google with the first line of a JAVA stack trace?

We can recommend more relevant solutions and speed up debugging when you paste your entire stack trace with the exception message. Try a sample exception.

Recommended solutions based on your search

Samebug tips

,
via Stack Overflow by Unknown author

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

,
via Stack Overflow by user569825

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

Solutions on the web

via Stack Overflow by Harshit
, 1 year ago
BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
via Stack Overflow by Sujeet Kumar Singh
, 1 year ago
BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
via Stack Overflow by hamid
, 1 year ago
BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
via Stack Overflow by Michał Górecki
, 1 year ago
BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
via Stack Overflow by Neerajkumar
, 1 year ago
BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
via Stack Overflow by Kendall H.
, 1 year ago
BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
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:170)
at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:921)
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:895)
at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:579)
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:5061)
at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5719)
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:1575)
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)

Users with the same issue

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, 2 years ago
Samebug visitor profile picture
Unknown user
Once, 1 year ago
Samebug visitor profile picture
Unknown user
Once, 1 year ago
167 more bugmates

Know the solutions? Share your knowledge to help other developers to debug faster.