2 Replies Latest reply on Sep 1, 2017 9:41 AM by tabincedric

    [EAP7.0.0] How to use EAR packaged library Hibernate 5.2.10 Final ?

    ctabin

      Hello,

       

      I'm deploying my EAR on JBoss EAP 7.0.0, which has the following structure:

      SNV4SRV.ear
      |-- ejb.jar
      |-- app.war
      |-- lib
           |-- hibernate-core-5.2.10.Final.jar
           |-- hibernate-hibernate-spatial-5.2.10.Final.jar
           |-- hibernate-commons-annotations-5.0.1.Final.jar
      |-- META-INF
           |-- application.xml
           |-- jboss-app.xml

      I added a small piece of code in one of my EJB bean that prints org.hibernate.Version.getVersionString() to know which version of Hibernate my app is using and it gives me 5.0.9.Final-readhat-1 instead of 5.2.10.Final.

       

      I've read a lot about classloading issues (especially here and here), but after many different trials, I couldn't find a way to make JBoss use the package version in my EAR of Hibernate. Is the <loader-repository> tag still handled in EAP 7 ?

       

      Here is my content of jboss-app.xml:

      <?xml version="1.0" encoding="UTF-8"?>
      <jboss-app> 
        <loader-repository>
         my.package:archive=app.ear
         <loader-repository-config> 
          java2ParentDelegation=false
           </loader-repository-config>
        </loader-repository> 
      </jboss-app>

       

      Is there a way to force JBoss EAP 7 to load the classes from my EAR before looking in the bootstrap classloader ?

       

      Thanks and best regards.

        • 1. Re: [EAP7.0.0] How to use EAR packaged library Hibernate 5.2.10 Final ?
          andey

           

          Recommended that to update the application to use the bundled Hibernate release...Hibernate Core 5.0.12.Final is fully compatible version in JBoss EAP 7.

           

          You need  try to exclude the supported Hibernate libraries which are bundled with EAP by excluding the org.hibernate module as detailed in (Class Loading in AS7 - JBoss AS 7.0 - Project Documentation Editor ) see Exclude Subsystem Dependency

           

          Automatic dependencies can be excluded through the use of jboss-deployment-structure.xml.

           

           

           

           

          • 2. Re: [EAP7.0.0] How to use EAR packaged library Hibernate 5.2.10 Final ?
            tabincedric

            Hello,

             

            Thanks for your response.

             

            Unfortunately, disabling the dependency on org.hibernate does not work: it crashes during the deployment.

            Here is what I tried:

            <pre>

            <jboss-deployment-structure>
              
            <deployment>
              
            <exclude-subsystems>
              
            <subsystem name="org.hibernate" />
              
            </exclude-subsystems>
              
            <exclusions>
              
            <module name="org.hibernate" />
              
            </exclusions>
              
            </deployment>
            </jboss-deployment-structure>

            </pre>

             

            And JBoss crashes with this message:

            <pre>

            {"WFLYCTL0062: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"WFLYCTL0080: Failed services" => {"jboss.persistenceunit.\"app.ear/ejb.jar#app-ejbPU\"" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"app.ear/ejb.jar#app-ejbPU\": java.util.ServiceConfigurationError: org.hibernate.integrator.spi.Integrator: Provider org.hibernate.envers.boot.internal.EnversIntegrator not a subtype
            Caused by: java.util.ServiceConfigurationError: org.hibernate.integrator.spi.Integrator: Provider org.hibernate.envers.boot.internal.EnversIntegrator not a subtype"}}}}

            </pre>