Excluding JPA Subsystem from JBoss EAP 6.1 - Trying to use JPA 2.1 in JBoss EAP 6.1

后端 未结 4 749
清酒与你
清酒与你 2021-02-08 05:08

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

相关标签:
4条回答
  • 2021-02-08 05:47

    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>
    

    0 讨论(0)
  • 2021-02-08 05:49

    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.

    0 讨论(0)
  • 2021-02-08 05:51

    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>
    
    0 讨论(0)
  • 2021-02-08 05:59

    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>
    
    0 讨论(0)
提交回复
热议问题