JBoss Community

Re: How to stop my WAR loading JBoss's provided 3rd party classes?

created by Ales Justin in JBoss Microcontainer - View the full discussion

Here's the relevant section of my project's pom.xml:

 

<dependency>

<groupId>org.hibernate</groupId>

<artifactId>hibernate-entitymanager</artifactId>

<version>3.6.0.Final</version>

<exclusions>

<exclusion>

<groupId>javax.transaction</groupId>

<artifactId>jta</artifactId>

</exclusion>

</exclusions>

</dependency>

 

I have also tried changing the scope of hibernate-entitymanager to "provided", in which case my project should be using JBoss 6's provided hibernate libraries, but when I do that I get this exception:

 

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:225) [:3.0.5.RELEASE]

at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:308) [:3.0.5.RELEASE]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477) [:3.0.5.RELEASE]

Hmmm, how can this happen if both you and JBossAS use the same Hibernate version?

This would mean that somehow JPA slips into your project, hence those JPA classes get used -- as by the servlet spec.

Otoh, JBoss' Hibernate of course doesn't use those JPA classes, but its own.

Reply to this message by going to Community

Start a new discussion in JBoss Microcontainer at Community