views:

56

answers:

2

I see a number of posts on the various problems folks have with troubleshooting this problem: ERROR context.ContextLoader - Context initialization failed org.springframework.beans.factory.BeanCreationException:

Is there a way to turn on debugging to isolate the problem?

Its complaining about "No such property: getOrg for class: groovy.lang.MetaClassImpl" but that's not directly one one of our classes, is there some way to get info that's relevant to our codebase?

In our case we had a Grails 1.2.1 app deployed and running just fine in Tomcat. We then stopped Tomcat to do a DB backup and then restarted the app. The same WAR with no environmental changes(i.e, no config file changes, etc.) now throws this error. We had observed this behavior intermittently previously as well, but restarting used to fix the prob.

In our development environment, the same app runs just fine with "grails prod run-app" as well as "grails prod run-war".

The stacktrace snippets:

2010-09-30 12:10:13,391 ERROR context.ContextLoader - Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messageSource': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is groovy.lang.MissingPropertyException: No such property: getOrg for class: groovy.lang.MetaClassImpl at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) at org.codehaus.groovy.grails.commons.spring.ReloadAwareAutowireCapableBeanFactory.doCreateBean(ReloadAwareAutowireCapableBeanFactory.java:129) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)

<<<<<<<< snip >>>>>>>>>>>>>>>>>>>>>>

Caused by: groovy.lang.MissingPropertyException: No such property: getOrg for class: groovy.lang.MetaClassImpl
        at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:49)
        at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.setProperty(ScriptBytecodeAdapter.java:485)
        at org.codehaus.groovy.grails.plugins.orm.hibernate.HibernatePluginSupport.handleLazyProxy(HibernatePluginSupport.groovy:413)
        at org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsDomainBinder.bindProperty(GrailsDomainBinder.java:2108)
        at org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsDomainBinder.createProperty(GrailsDomainBinder.java:1829)
        at org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsDomainBinder.createClassProperties(GrailsDomainBinder.java:1565)
        at org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsDomainBinder.bindJoinedSubClass(GrailsDomainBinder.java:1272)
        at org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsDomainBinder.bindSubClass(GrailsDomainBinder.java:1219)
        at org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsDomainBinder.bindSubClasses(GrailsDomainBinder.java:1186)
        at org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsDomainBinder.bindRoot(GrailsDomainBinder.java:1160)
        at org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsDomainBinder.bindClass(GrailsDomainBinder.java:1040)
        at org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsAnnotationConfiguration.secondPassCompile(GrailsAnnotationConfiguration.java:145)
        at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1148)
        at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:717)
        at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1460)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1398)
+1  A: 

If you set logging level to DEBUG for packages org.springframework and org.codehaus.groovy then you will be able to get more details.

But in case of grails sometimes it helps just to stop tomcat, remove work and temp directories and start tomcat again.

uthark
A: 

I've gotten this in grails 1.3.4, and removing the tomcat work and temp directories ($CATALINA_BASE/temp, $CATALINA_BASE/work) does seem to fix the problem.

Dan Lynn
Thanks uthark and Dan, cleaning out the tomcat temp and work directories did indeed fix the issue. Any thoughts on why? It sounds like a Tomcat bug to me
Sunny