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.


,
via Stack Overflow by Unknown author

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


,
via Stack Overflow by user569825

Solutions on the web311

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

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

Solution icon of coderanch
via Coderanch by samuel john, 9 months ago
BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext

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

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
, 5 months ago
BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext

Solution icon of googlegroups
via Google Groups by Emil Hedenberg, 4 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 Emery Mersich, 3 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

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, 1 year 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, 3 weeks ago
164 more bugmates