I have a war application which contains JPA 2.1 API and Hibernate 4.3.0.Final ( JPA 2.1 implementation) packaged and bootstrapped using Spring container and I want to deploy th
If you're Maven this did the trick for me.
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
</dependency>
jboss-deployment-structure.xml
<deployment>
<exclude-subsystems>
<subsystem name="jpa" />
</exclude-subsystems>
<exclusions>
<module name="javaee.api" />
</exclusions>
</deployment>
The above answers are great, but they are introducing other problems in many applications by excluding the whole Java EE API.
If you don't want to do so, then go to JBOSS_HOME\modules\javaee\api\main\module.xml
and set export to false for javax.persistence.api
, like this:
<module name="javax.persistence.api" export="false"/>
Note that this will disable the persistence API for every application deployed in the same EAP.
You still need to delete the JPA subsystem from standalone.xml
, but you don't need to change jboss-deployment-structure.xml
, or at least I didn't have to.
We found another solution.
You can also exclude the jpa subsystem in jboss-deployment-structure.xml of the war:
<exclude-subsystems>
<subsystem name="jpa" />
</exclude-subsystems>
<exclusions>
<module name="javaee.api" />
</exclusions>
Found a solution that seems to work with hibernate-core-4.3.1.
Step 1: remove subsystem jpa from standalone.xml:
<subsystem xmlns="urn:jboss:domain:jpa:1.1">
<jpa default-datasource="" default-extended-persistence-inheritance="DEEP"/>
</subsystem>
Thanks to this blog article: http://mariemjabloun.blogspot.nl/2014/02/jboss-eap-6-persistence-unit-problem.html
Step 2: exclude jpa, javaee modules in jboss-deployment-structure.xml of the war:
<exclusions>
<module name="javax.persistence.api"/>
<module name="javaee.api"/>
</exclusions>