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

,

Upgrade spring-web and spring-webmvc dependencies. Also upgrade your Java version to Java 8 if using less.

,
via Stack Overflow by Unknown author

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

Solutions on the web

via Coderanch by chrstian ferma, 1 year ago
BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
via Stack Overflow by JDeveloper
, 1 year ago
BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
via pe.kr by Unknown author, 2 years ago
via coderanch.com by Unknown author, 1 year ago
BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
via Stack Overflow by karl963
, 2 years ago
BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
via com.br by Unknown author, 2 years 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:551)
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4980)
at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5626)
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:1559)
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:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)

Users with the same issue

Once, 2 months ago
Once, 1 year ago
6 times, 1 year ago
Samebug visitor profile picture
Unknown user
Once, 6 months ago
Samebug visitor profile picture
Unknown user
Once, 8 months ago

Write tip

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