Grails
  1. Grails
  2. GRAILS-8492

Grails App with EJB domain throws AnnotationConfiguration mapping exception on JBoss EAP 5.1.2

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.0-RC3
    • Fix Version/s: None
    • Component/s: Persistence
    • Labels:
      None
    • Environment:
      Grails 2.0-RC3, Win7x64, Java 1.6_u23, JBoss EAP 5.1.2

      Description

      I have a JAR with a simple @Entity/@Table annotated entity.

      My hibernate.cfg.xml:

      <hibernate-configuration>
          <session-factory>
              <mapping package="some.test.package" />
              <mapping class="some.test.package.TestObject" />
          </session-factory>
      </hibernate-configuration>
      

      In my DataSource.groovy:

      import org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsAnnotationConfiguration
      
      production {
        dataSource {
          jndiName="java:/SomeDS"
          configClass = GrailsAnnotationConfiguration.class
        }
      }
      

      In order to get past the hibernate validator issue I had to create a jboss-classloading.xml which oddly enough can be empty:

      <?xml version="1.0" encoding="UTF-8"?>
      <classloading xmlns="urn:jboss:classloading:1.0"
              domain="test.war"
              >
      </classloading>
      

      However, I am now stuck at:

      Caused by: org.hibernate.MappingException: An AnnotationConfiguration instance is required to use <mapping package="some.test.package"/>
      	at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1641)
      	at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1602)
      	at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1581)
      	at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1555)
      	at org.hibernate.cfg.Configuration.configure(Configuration.java:1490)
      	at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:642)
      	at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
      	at org.codehaus.groovy.grails.orm.hibernate.ConfigurableLocalSessionFactoryBean.afterPropertiesSet(ConfigurableLocalSessionFactoryBean.java:145)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1503)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1441)
      

      Standalone, everything runs fine. Without the hibernate.cfg.xml the application deploys fine.

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Unassigned
            Reporter:
            Alex Duan
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Last Reviewed:

              Development