aspose file tools*
The moose likes Spring and the fly likes BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the Applic Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "BeanFactory not initialized or already closed - call Watch "BeanFactory not initialized or already closed - call New topic
Author

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

Methari Gangadhar
Greenhorn

Joined: May 15, 2011
Posts: 12
When i stop the Tomcat6 server getting below exception.


WARNING: Error while removing context [/TestWebApp-0.0.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(AbstractRefreshableApplicationContext.java:153)
at org.springframework.context.support.AbstractApplicationContext.containsBean(AbstractApplicationContext.java:893)
at com.test.caching.support.CacheConfigServiceSupport.retreive(CacheConfigServiceSupport.java:57)
at com.test.caching.support.CacheInterceptor.retreiveConfiguration(CacheInterceptor.java:269)
at com.test.caching.support.CacheInterceptor.invoke(CacheInterceptor.java:159)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy17.toString(Unknown Source)
at org.apache.catalina.loader.WebappClassLoader.clearThreadLocalMap(WebappClassLoader.java:2097)
at org.apache.catalina.loader.WebappClassLoader.clearReferencesThreadLocals(WebappClassLoader.java:2027)
at org.apache.catalina.loader.WebappClassLoader.clearReferences(WebappClassLoader.java:1710)
at org.apache.catalina.loader.WebappClassLoader.stop(WebappClassLoader.java:1622)
at org.apache.catalina.loader.WebappLoader.stop(WebappLoader.java:710)
at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4649)
at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:924)
at org.apache.catalina.startup.HostConfig.undeployApps(HostConfig.java:1319)
at org.apache.catalina.startup.HostConfig.stop(HostConfig.java:1290)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:323)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1086)
at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1098)
at org.apache.catalina.core.StandardEngine.stop(StandardEngine.java:448)
at org.apache.catalina.core.StandardService.stop(StandardService.java:584)
at org.apache.catalina.core.StandardServer.stop(StandardServer.java:744)
at org.apache.catalina.startup.Catalina.stop(Catalina.java:643)
at org.apache.catalina.startup.Catalina.start(Catalina.java:618)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)

any help would be appreciated.

Thanks,
Gangadhar
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17259
    
    6

Do you have any destroy-method or @PreDestroy methods in your configuration? Do you have any finalize code?

It seems that you close the application, which closes the applicationContext but someone somewhere after it is closed is trying to get a bean out of it.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Methari Gangadhar
Greenhorn

Joined: May 15, 2011
Posts: 12
Hi Mark,

Thanks for your reply, but here we don't have destroy method neither we use @preDestroy annotations, am sure we havent used delete the application context related code in the application.
But we do have User Session time out configured in one of the database table is it because of that.

Thanks in advance.

Thanks,
Gangadhar
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the Applic