users@glassfish.java.net

Deployment issues with Grails and JPA

From: Martin Grebac <Martin.Grebac_at_Sun.COM>
Date: Wed, 05 Mar 2008 17:31:33 +0100

Hi,
 I'm trying to get together a JPA (better say jsr220-annotation) based
example with Grails and GlassFish, but encountered problems. Hibernate
based samples work fine, but when I try to deploy the JPA annotation
based, it sometimes works, sometimes not and I get this one:

#|2008-02-29T20:24:36.678+0000|SEVERE|sun-appserver9.1|
 javax.enterprise.system.container.web|_ThreadID
 ;_ThreadName=Timer-5;_RequestID=da9e7d3e-57db-454d-8ba8-8dc7ad5aed64;|
 WebModule[/CustomerJPA-0.1]PWC1275: Exception sending context
 initialized event to listener instance of class
 org.codehaus.groovy.grails.web.context.GrailsContextLoaderListener
 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: An
 AnnotationConfiguration instance is required to use <mapping
 package="entity"/>
 java.security.AccessController.doPrivileged(Native Method)
 org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4523)
 org.apache.catalina.core.StandardContext.start(StandardContext.java:
 com.sun.enterprise.web.WebModule.start(WebModule.java:326)
 org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:973)
 org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:957)
 org.apache.catalina.core.StandardHost.addChild(StandardHost.java:688)
 com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:
 com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:

  Restart of server sometimes helps, sometimes not.

  However, if I try to undeploy & deploy the app again, I'm getting
 into different kind of troubles:

 Message: Error creating bean with name 'grailsUrlMappingsHolder':
 Cannot resolve reference to bean 'urlMappingsTargetSource' while
 setting bean property 'targetSource'; nested exception is
 org.springframework.beans.factory.BeanCreationException: Error
 creating bean with name 'urlMappingsTargetSource': Cannot resolve
 reference to bean 'grailsUrlMappingsHolderBean' while setting
 constructor argument; nested exception is
 org.springframework.beans.factory.BeanCreationException: Error
 creating bean with name 'grailsUrlMappingsHolderBean': Invocation of
 init method failed; nested exception is java.lang.RuntimeException:
 mappings closure does not exists for class UrlMappings
 Caused by: Error creating bean with name
 'org.codehaus.groovy.grails.plugins.web.taglib.ApplicationTagLib':
 Initialization of bean failed; nested exception is
 org.springframework.beans.factory.BeanCreationException: Error
 creating bean with name 'grailsUrlMappingsHolder': Cannot resolve
 reference to bean 'urlMappingsTargetSource' while setting bean
 property 'targetSource'; nested exception is
 org.springframework.beans.factory.BeanCreationException: Error
 creating bean with name 'urlMappingsTargetSource': Cannot resolve
 reference to bean 'grailsUrlMappingsHolderBean' while setting
 constructor argument; nested exception is
 org.springframework.beans.factory.BeanCreationException: Error
 creating bean with name 'grailsUrlMappingsHolderBean': Invocation of
 init method failed; nested exception is java.lang.RuntimeException:
 mappings closure does not exists for class UrlMappings

 Anyone knows what could be going on?

Thanks,
 MartinG