2011-08-21 92 views
5

隨着在Tomcat 7的Grails 2.0.0,我得到以下正確的啓動:我該如何處理「IllegalStateException:BeanFactory未初始化或已經關閉」?

2011-08-21 11:10:09,758 [main] ERROR StackTrace - Full Stack Trace: 
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:172) 
     at org.springframework.context.support.AbstractApplicationContext.containsBean(AbstractApplicationContext.java:1109) 
     at org.codehaus.groovy.grails.web.context.GrailsContextLoader$1.run(GrailsContextLoader.java:88) 
     at org.codehaus.groovy.grails.lifecycle.ShutdownOperations.runOperations(ShutdownOperations.java:62) 
     at org.codehaus.groovy.grails.web.context.GrailsContextLoader.closeWebApplicationContext(GrailsContextLoader.java:136) 
     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(Thread.java:619) 
     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.addChildInternal(ContainerBase.java:812) 
     at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:787) 
     at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:607) 
     at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:633) 
     at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:558) 
     at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:468) 
     at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1322) 
     at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311) 
     at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) 
     at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:89) 
     at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:379) 
     at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:324) 
     at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1041) 
     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(NativeMethodAccessorImpl.java:39) 
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
     at java.lang.reflect.Method.invoke(Method.java:597) 
     at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:303) 
     at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:431) 
2011-08-21 11:10:09,761 [main] ERROR StackTrace - Full Stack Trace: 
java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext 
     at java.lang.Thread.run(Thread.java:619) 

什麼能這樣做的原因是什麼?如何解決?

注意:如果您知道該解決方案,您也可以按其他用戶發佈的"call 'refresh'" error resulting from Grails WAR hot-deploy回答。

+3

應該有另一個跟蹤之前這個 – Bozho

+0

它實際上是整個日誌文件... – user569825

回答

8

原來在日誌文件catalina.out中提供了其他信息。當我發佈問題時,我只檢查了應用程序特定的stacktrace.log

謝謝https://stackoverflow.com/users/203907/bozho的提示!

該問題源於應用程序無法連接到數據庫。

因此,它可以通過在數據庫端配置訪問權限來解決。

+1

謝謝,我的結果是由壞的彈簧安全配置引起的,但這幫助我追蹤它。 –

相關問題