本文介绍了运行在Tomcat6上的Grails应用程序 - 上下文初始化失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Grails(1.3.7)中开发了一个应用程序,并在运行于Ubuntu服务器上的Tomcat6上运行它。

在部署应用程序后报告此错误。你有什么想法可能是错误的?

  2011-12-18 00:06:41,319 [main] ERROR context.ContextLoader - 上下文初始化失败
org.springframework.beans.factory.BeanCreationException:在ServletContext资源[/WEB-INF/applicationContext.xml]中定义的名为'pluginManager'的bean创建错误:调用init方法失败;嵌套的例外是groovy.lang.MissingPropertyException:没有这样的属性:静态类:groovy.lang.MetaClassImpl
在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
。在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
。在org.springframework.beans.factory.support.AbstractBeanFactory $ 1.getObject(AbstractBeanFactory.java:291)
在org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory .support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
在org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:563)
在org.springframework.context.support .AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
at org.springframework.web.context.ContextLoader.createWebApplicationContext (ContextLoader.java:276)
在org.codehaus.groovy.grails.web.context.GrailsContextLoader.createWebApplicationContext(GrailsContextLoader.java:70)在org.springframework.web.context.ContextLoader.initWebApplicationContext
(ContextLoader.java:197)
在org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
在org.apache.catalina。 core.StandardContext.listenerStart(StandardContext.java:4135)
处org.apache.catalina.core.ContainerBase org.apache.catalina.core.StandardContext.start(StandardContext.java:4630)
。 addChildInternal(ContainerBase.java:791)
在org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
在org.apache.catalina.core.StandardHost.addChild(StandardHost。 Java的:在org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:905 546)

在org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:740)在org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:500)
在org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)

在org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache .catalina.core .ContainerBase.start(ContainerBase.java:1053)
在org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
在org.apache.catalina.core.ContainerBase.start (ContainerBase.java:1045)
在org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
在org.apache.catalina.core.StandardService.start(StandardService.java :519)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
。在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)
在sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java :43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
在org.apache。 catalina.startup.Bootstrap.main(Bootstrap.java:414)
导致:groovy.lang.MissingPropertyException:没有这样的属性:静态类:groovy.lang.MetaClassImpl
在org.codehaus.groovy .runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:49)
在org.codehaus.groovy.runtime.callsite.PojoMetaClassGetPropertySite.getProperty(PojoMetaClassGetPropertySite.java:35)
在org.codehaus.groovy.runtime .callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:235)
at org.codehaus.groovy.grails.plugins.DomainClassGrailsPlugin.registerConstraintsProperty(DomainClassGrailsPlugin.groovy:169)
at org.codehaus.groovy.grails .commons.DefaultGrailsDomainClassProperty $ ComponentDomainClass。< init>(DefaultGrailsDomainClassProperty.java:543)
at org.codehaus.groovy.grails.commons.DefaultGrailsDomainClassProperty.setEmbedded(DefaultGrailsDomainClassProperty.java:484)
at org。 codehaus.groovy.grails.c ommons.DefaultGrailsDomainClass.establishDomainClassRelationship(DefaultGrailsDomainClass.java:481)
位于org.codehaus.groovy.grails.commons.DefaultGrailsDomainClass.establishRelationships(DefaultGrailsDomainClass.java:252)
位于org.codehaus.groovy.grails。 common.DefaultGrailsDomainClass。< init>(DefaultGrailsDomainClass.java:108)
at org.codehaus.groovy.grails.commons.DefaultGrailsDomainClass。< init>(DefaultGrailsDomainClass.java:119)
at org。 codehaus.groovy.grails.commons.DomainClassArtefactHandler.newArtefactClass(DomainClassArtefactHandler.java:52)
at org.codehaus.groovy.grails.commons.AnnotationDomainClassArtefactHandler.newArtefactClass(AnnotationDomainClassArtefactHandler.java:53)
at org。 codehaus.groovy.grails.commons.DefaultGrailsApplication.addArtefact(DefaultGrailsApplication.java:640)
位于org.codehaus.groovy.grails.commons.DefaultGrailsApplication.configureLoadedClasses(DefaultGrailsA
at org.codehaus.groovy.grails.commons.DefaultGrailsApplication.initialise(DefaultGrailsApplication.java:857)
at org.codehaus.groovy.grails.plugins.GrailsPluginManagerFactoryBean.afterPropertiesSet( GrailsPluginManagerFactoryBean.java:110)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean( AbstractAutowireCapableBeanFactory.java:1417)
... 37 more


解决方案

不确定这仍然是你的问题,但我认为这是一个grails应用程序的重新部署?上下文加载实际上失败的地方是随机的(它发生在本地化类上)。

根据这里接受的答案:



...理论上错误或错误配置与你的tomcat缓存。

删除tomcat6 / work和/ tmp目录中的文件并尝试重新部署。我的ubuntu机器上的tomcat6 $ CATALINA_HOME / work 目录实际上是 / var / cache / tomcat6


I have developed an application in Grails (1.3.7) and I am running it on Tomcat6, which is running on Ubuntu Server.

This error is reported after deploy of the application. Do you have idea what might be wrong?

2011-12-18 00:06:41,319 [main] ERROR context.ContextLoader  - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pluginManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is groovy.lang.MissingPropertyException: No such property: static for class: groovy.lang.MetaClassImpl
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:563)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
        at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
        at org.codehaus.groovy.grails.web.context.GrailsContextLoader.createWebApplicationContext(GrailsContextLoader.java:70)
        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4135)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4630)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:905)
        at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:740)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:500)
        at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
        at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
        at org.apache.catalina.core.StandardService.start(StandardService.java:519)
        at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:616)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: groovy.lang.MissingPropertyException: No such property: static for class: groovy.lang.MetaClassImpl
        at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:49)
        at org.codehaus.groovy.runtime.callsite.PojoMetaClassGetPropertySite.getProperty(PojoMetaClassGetPropertySite.java:35)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:235)
        at org.codehaus.groovy.grails.plugins.DomainClassGrailsPlugin.registerConstraintsProperty(DomainClassGrailsPlugin.groovy:169)
        at org.codehaus.groovy.grails.commons.DefaultGrailsDomainClassProperty$ComponentDomainClass.<init>(DefaultGrailsDomainClassProperty.java:543)
        at org.codehaus.groovy.grails.commons.DefaultGrailsDomainClassProperty.setEmbedded(DefaultGrailsDomainClassProperty.java:484)
        at org.codehaus.groovy.grails.commons.DefaultGrailsDomainClass.establishDomainClassRelationship(DefaultGrailsDomainClass.java:481)
        at org.codehaus.groovy.grails.commons.DefaultGrailsDomainClass.establishRelationships(DefaultGrailsDomainClass.java:252)
        at org.codehaus.groovy.grails.commons.DefaultGrailsDomainClass.<init>(DefaultGrailsDomainClass.java:108)
        at org.codehaus.groovy.grails.commons.DefaultGrailsDomainClass.<init>(DefaultGrailsDomainClass.java:119)
        at org.codehaus.groovy.grails.commons.DomainClassArtefactHandler.newArtefactClass(DomainClassArtefactHandler.java:52)
        at org.codehaus.groovy.grails.commons.AnnotationDomainClassArtefactHandler.newArtefactClass(AnnotationDomainClassArtefactHandler.java:53)
        at org.codehaus.groovy.grails.commons.DefaultGrailsApplication.addArtefact(DefaultGrailsApplication.java:640)
        at org.codehaus.groovy.grails.commons.DefaultGrailsApplication.configureLoadedClasses(DefaultGrailsApplication.java:347)
        at org.codehaus.groovy.grails.commons.DefaultGrailsApplication.initialise(DefaultGrailsApplication.java:857)
        at org.codehaus.groovy.grails.plugins.GrailsPluginManagerFactoryBean.afterPropertiesSet(GrailsPluginManagerFactoryBean.java:110)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
        ... 37 more
解决方案

Not sure this is still an issue for you, but I assume that this is a re-deploy of a grails application? Where the context loading actually fails is random (it happened to me on a localization class).

According to the accepted answer here: How to debug ContextLoader - Context initialization failed and BeanCreationException

... something is theoretically wrong wrong or misconfigured with your tomcat cache.

Remove the files in your tomcat6 /work and /tmp directories and try to re-deploy. The tomcat6 $CATALINA_HOME/work directory on my ubuntu machine is actually /var/cache/tomcat6.

这篇关于运行在Tomcat6上的Grails应用程序 - 上下文初始化失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-09 12:04