I'm trying to integrate a Java domain and service layer with a Grails app. The Java projects are built with Maven and the Grails project loads the JARs from the Maven repo. The service project contains an XML Spring config file, that defines a bunch of Spring beans. I'm trying to make these available to the Grails app, by loading these beans in grails-app/conf/spring/resources.groovy
Code:
beans = {
importBeans('classpath:/applicationContext-services.xml')
}
One of the beans in this file is an instance of LocalContainerEntityManagerFactoryBean. On attempting to create this bean, I get the error:
Error creating bean with name 'entityManagerFactory' defined in class path resource [applicationContext-services.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: javax.persistence.spi.PersistenceUnitInfo.getValid ationMode()Ljavax/persistence/ValidationMode;
Based on this issue in Spring's JIRA, it would appear that the underlyiing problem is some incompatibility between the Spring and Hibernate/JPA versions. It appears that I'm using:
- Spring 3.0.5.RELEASE
- Hibernate 3.6.0.Final
- Hibernate-jpa-2.0-api 1.0.0.Final
I tried removing the Hibernate plugin from the Grails app, but it didn't seem to make any difference.