Note that there are some explanatory texts on larger screens.

plurals
  1. POUpgrading from Grails 1.3.9 to Grails 2.2.1 produces error in domain class
    text
    copied!<p>I am in the process of upgrading an app from Grails 1.3.9 to Grails 2.2.1. When I issue the run-app command, I get a long stacktrace that begins with this error and then more or less repeats it for about 400 lines:</p> <pre><code>2013-03-07 13:32:11.364 ERROR [ StackTrace] Full Stack Trace: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManagerPostProcessor': 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 org.hibernate.MappingException: property [sponsoringManager] not found on entity [com.mycompany.myapp.ManagerDelegate] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527) at org.codehaus.groovy.grails.commons.spring.ReloadAwareAutowireCapableBeanFactory.doCreateBean(ReloadAwareAutowireCapableBeanFactory.java:118) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:713) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:457) at org.codehaus.groovy.grails.commons.spring.DefaultRuntimeSpringConfiguration.getApplicationContext(DefaultRuntimeSpringConfiguration.java:153) at org.codehaus.groovy.grails.commons.spring.GrailsRuntimeConfigurator.configure(GrailsRuntimeConfigurator.java:170) at org.codehaus.groovy.grails.commons.spring.GrailsRuntimeConfigurator.configure(GrailsRuntimeConfigurator.java:127) at org.codehaus.groovy.grails.web.context.GrailsConfigUtils.configureWebApplicationContext(GrailsConfigUtils.java:121) at org.codehaus.groovy.grails.web.context.GrailsContextLoader.initWebApplicationContext(GrailsContextLoader.java:107) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4791) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5285) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662) </code></pre> <p>I think the pertinent part is this:</p> <pre><code>org.hibernate.MappingException: property [sponsoringManager] not found on entity [com.mycompany.myapp.ManagerDelegate] </code></pre> <p>Here's the code for the ManagerDelegate domain class, which is a many to many join class:</p> <pre><code>package com.mycompany.myapp class ManagerDelegate extends Base implements Serializable { static belongsTo = [sponsoringManager:User, delegate:User] boolean equals(other) { if (!(other instanceof ManagerDelegate)) { return false } other.sponsoringManager.id == sponsoringManager.id &amp;&amp; other.delegate.id == delegate.id } static mapping = { id composite: [ 'sponsoringManager', 'delegate' ] version false } } </code></pre> <p>As you can see, ManagerDelegate does contain a sponsoringManager property which is declared in the belongsTo statement. This worked perfectly in Grails 1.3.9.</p> <p>Here is the User class:</p> <pre><code>class User { static hasMany = [sponsoringManagers: ManagerDelegate, delegates: ManagerDelegate] static mappedBy = [sponsoringManagers: "delegate", delegates: "sponsoringManager"] static mapping = { id generator: 'uuid' sponsoringManagers cascade: 'all-delete-orphan' delegates cascade: 'all-delete-orphan' } ... } </code></pre> <p>When I try to access the app from my browser, nothing is displayed and no log output is produced.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload