[jboss-user] [EJB 3.0] - Error when using JPA with Spring

wiberto do-not-reply at jboss.com
Sat Jul 28 02:06:48 EDT 2007


I'm not sure if this is the right forum to post, but I'm running out of places. I have some Spring code that creates an EntityManager with hibernate and it's giving me an error. If I run the same code in a junit (pointing to the hibernate jars inside the jboss AS 4.2.0) it runs fine. I checked all jars and I only have that one version in the classpath.

Is there anything known about trying to do this stuff inside JBoss? I haven't tried another container, but this is strange.

Here's the error message:


  | 18:23:46,628 INFO  [XmlBeanDefinitionReader] Loading XML bean definitions from class path resource [applicationContext.xml]
  | 18:23:50,742 INFO  [LocalContainerEntityManagerFactoryBean] Building JPA container EntityManagerFactory for persistence unit 'lingraph-persistence'
  | 18:23:53,995 ERROR [DefaultFaultHandler] Fault occurred!
  | org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'orderRepository' defined in class path resource [applicationContext.xml]: Cannot resolve reference to bean 'entityManagerFactory' while setting bean property 'entityManagerFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.IncompatibleClassChangeError: Class org.hibernate.ejb.HibernatePersistence does not implement the requested interface javax.persistence.spi.PersistenceProvider
  | Caused by: 
  | org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.IncompatibleClassChangeError: Class org.hibernate.ejb.HibernatePersistence does not implement the requested interface javax.persistence.spi.PersistenceProvider
  | Caused by: 
  | java.lang.IncompatibleClassChangeError: Class org.hibernate.ejb.HibernatePersistence does not implement the requested interface javax.persistence.spi.PersistenceProvider
  | 	at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:218)
  | 	at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:251)
  | 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1202)
  | 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1172)
  | 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:428)
  | 	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
  | 	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156)
  | 	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
  | 	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
  | 	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:261)
  | 	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:109)
  | 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1100)
  | 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:862)
  | 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:424)
  | 	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
  | 	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156)
  | 	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
  | 	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
  | 	at test.numbersinsight.lingraph.order.webservices.CardOrderUpdateServiceTestImpl.getNewOrders(CardOrderUpdateServiceTestImpl.java:34)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4068425#4068425

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4068425



More information about the jboss-user mailing list