Search code examples
hibernatejbossclassloading

JBoss 6.4 classloading


I have an .ear which contains multiples .war and I would like to deploy it into a jboss 6.4.7 server. The problem is that one of the .war is using a jboss's module (hibernate-jpa-2.0) but the app requires the hibernate-jpa-2.1 version. How to tell my war not using this jboss module. I have added a jboss-deployment-structure into the Ear/application/META-INF with this exclusion :

<jboss-deployment-structure>
<ear-subdeployments-isolated>true</ear-subdeployments-isolated>

<sub-deployment name="myapp.war">
        <exclusions>
            <module name="javax.persistence.api" /> 
        </exclusions>
    </sub-deployment>
</jboss-deployment-structure>

but not working..

The "javax.persistence.api" is written on the module.xml on the jboss server.

Thanks for your help.


Solution

  • Add following

    <jboss-deployment-structure>
    <ear-subdeployments-isolated>true</ear-subdeployments-isolated>
        <sub-deployment name="myapp.war">
        <exclude-subsystems>
            <subsystem name="jpa" />
        </exclude-subsystems>
        <exclusions>
            <module name="javaee.api" />
        </exclusions>
            </sub-deployment>
        </jboss-deployment-structure>
    

    A subsystem is the set of capabilities added by an extension.It defines how it will be used and configured. It is also defined in the EAP configuration file (standalone.xml or domain.xml) using the tag under a profile. For every extension added in an EAP instance, the capabilities and attributes of that extension are configured with the <subsystem> element.

    Another option can be just replace jar in the JBOSS with newer one