5 Replies Latest reply on Mar 27, 2013 1:12 AM by klind

    Exclude native hibernate and use user-provided hibernate

    klind

      Hi, I am want use hibernate 4.1.10 instead of the jboss provided 4.0.1.

       

      I made this jboss-deployment-structure

       

       

      <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">

        <!-- Make sub deployments isolated by default, so they cannot see each others classes without a Class-Path entry -->

        <ear-subdeployments-isolated>true</ear-subdeployments-isolated>

        <!-- This corresponds to the top level deployment. For a war this is the war's module, for an ear -->

        <!-- This is the top level ear module, which contains all the classes in the EAR's lib folder     -->

        <deployment>

           <!-- exclude-subsystem prevents a subsystems deployment unit processors running on a deployment -->

           <!-- which gives basically the same effect as removing the subsystem, but it only affects single deployment -->

           <exclude-subsystems>

              <subsystem name="org.hibernate" />

              <subsystem name="org.hibernate.validator" />

          </exclude-subsystems>

          <!-- Exclusions allow you to prevent the server from automatically adding some dependencies     -->

          <exclusions>

              <module name="org.hibernate" />

              <module name="org.hibernate.validator" />

          </exclusions>

        </deployment>

      </jboss-deployment-structure>

       

       

      I am not sure on when to use exclude-subsystems and exclusions

       

      How can I see that jboss actually excludes hibernate and uses the hibernate in the ear/lib   ??

        • 1. Re: Exclude native hibernate and use user-provided hibernate
          smarlow

          klind wrote:

           

          Hi, I am want use hibernate 4.1.10 instead of the jboss provided 4.0.1.

           

           

          Easiest way is to replace the current Hibernate jars with newer ones (you might need to be on a newer AS7 version).  Doc for replacing the Hibernate jars is here

           

          This will get easier, just not there yet.

           

           

           

          I made this jboss-deployment-structure

           

           

          <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">

            <!-- Make sub deployments isolated by default, so they cannot see each others classes without a Class-Path entry -->

            <ear-subdeployments-isolated>true</ear-subdeployments-isolated>

            <!-- This corresponds to the top level deployment. For a war this is the war's module, for an ear -->

            <!-- This is the top level ear module, which contains all the classes in the EAR's lib folder     -->

            <deployment>

               <!-- exclude-subsystem prevents a subsystems deployment unit processors running on a deployment -->

               <!-- which gives basically the same effect as removing the subsystem, but it only affects single deployment -->

               <exclude-subsystems>

                  <subsystem name="org.hibernate" />

                  <subsystem name="org.hibernate.validator" />

              </exclude-subsystems>

              <!-- Exclusions allow you to prevent the server from automatically adding some dependencies     -->

              <exclusions>

                  <module name="org.hibernate" />

                  <module name="org.hibernate.validator" />

              </exclusions>

            </deployment>

          </jboss-deployment-structure>

           

           

          I am not sure on when to use exclude-subsystems and exclusions

          I don't think this approach is going to help you.

           

           

          How can I see that jboss actually excludes hibernate and uses the hibernate in the ear/lib   ??

          Good question, I like to enable TRACE logging for org.jboss.as.jpa and org.hibernate, you should get some hints as to which version is used is the trace output.  Instructions are here for enabling trace logging.

          • 2. Re: Exclude native hibernate and use user-provided hibernate
            klind

            OK, first of all I didn't have the xml in the right directory. Now it is in the META-INF of the ear file.

             

            Now I get this

             

             

            14:47:11,416 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 1) JBAS014774: Service status report

            JBAS014775:    New missing/unsatisfied dependencies:

                  service jboss.deployment.subunit."jsi-3.30.2-SNAPSHOT.ear"."ear-3.30.2-SNAPSHOT/dashboard-3.30.2-SNAPSHOT.war".STRUCTURE (missing) dependents: [service jb

            oss.deployment.unit."jsi-3.30.2-SNAPSHOT.ear".PARSE]

                  service jboss.deployment.subunit."jsi-3.30.2-SNAPSHOT.ear"."ear-3.30.2-SNAPSHOT/server-3.30.2-SNAPSHOT.jar".STRUCTURE (missing) dependents: [service jboss

            .deployment.unit."jsi-3.30.2-SNAPSHOT.ear".PARSE]

             

             

            14:47:11,436 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 2) {"JBAS014653: Composite operation failed and was rolled back. Steps

            that failed:" => {"Operation step-2" => {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.deployment.unit.\"jsi-3.30.2-SNAPSHOT.ear\".PAR

            SEjboss.deployment.subunit.\"jsi-3.30.2-SNAPSHOT.ear\".\"ear-3.30.2-SNAPSHOT/server-3.30.2-SNAPSHOT.jar\".STRUCTURE, jboss.deployment.subunit.\"jsi-3.30.2-SNAPS

            HOT.ear\".\"ear-3.30.2-SNAPSHOT/dashboard-3.30.2-SNAPSHOT.war\".STRUCTUREMissing[jboss.deployment.unit.\"jsi-3.30.2-SNAPSHOT.ear\".PARSEjboss.deployment.subunit

            .\"jsi-3.30.2-SNAPSHOT.ear\".\"ear-3.30.2-SNAPSHOT/server-3.30.2-SNAPSHOT.jar\".STRUCTURE, jboss.deployment.subunit.\"jsi-3.30.2-SNAPSHOT.ear\".\"ear-3.30.2-SNA

            PSHOT/dashboard-3.30.2-SNAPSHOT.war\".STRUCTURE]"]}}}

            15:15:02,270 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015876: Starting deployment of "jsi-3.30.2-SNAPSHOT.ear"

            15:15:56,060 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-11) MSC00001: Failed to start service jboss.deployment.unit."jsi-3.30.2-SNAPSHOT.ear".STRU

            CTURE: org.jboss.msc.service.StartException in service jboss.deployment.unit."jsi-3.30.2-SNAPSHOT.ear".STRUCTURE: Failed to process phase STRUCTURE of deploymen

            t "jsi-3.30.2-SNAPSHOT.ear"

                    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]

                    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

                    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

                    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_13]

                    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_13]

                    at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_13]

            Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: Error loading jboss-structure.xml from C:\jboss\standalone\tmp\vfs\tempcc3634a528cd

            e5ba\jsi-3.30.2-SNAPSHOT.ear-8b03e0a31b33906\contents\META-INF\jboss-deployment-structure.xml

                    at org.jboss.as.server.deployment.module.descriptor.DeploymentStructureDescriptorParser.parse(DeploymentStructureDescriptorParser.java:277) [jboss-as-se

            rver-7.1.1.Final.jar:7.1.1.Final]

                    at org.jboss.as.server.deployment.module.descriptor.DeploymentStructureDescriptorParser.parse(DeploymentStructureDescriptorParser.java:249) [jboss-as-se

            rver-7.1.1.Final.jar:7.1.1.Final]

                    at org.jboss.as.server.deployment.module.descriptor.DeploymentStructureDescriptorParser.deploy(DeploymentStructureDescriptorParser.java:134) [jboss-as-s

            erver-7.1.1.Final.jar:7.1.1.Final]

                    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]

                    ... 5 more

            Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1]

            Message: Unexpected element '{urn:jboss:deployment-structure:1.2}jboss-deployment-structure'

                    at org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:108) [staxmapper-1.1.0.Final.jar:1.1.0.Final]

                    at org.jboss.staxmapper.XMLMapperImpl.parseDocument(XMLMapperImpl.java:69) [staxmapper-1.1.0.Final.jar:1.1.0.Final]

                    at org.jboss.as.server.deployment.module.descriptor.DeploymentStructureDescriptorParser.parse(DeploymentStructureDescriptorParser.java:271) [jboss-as-se

            rver-7.1.1.Final.jar:7.1.1.Final]

             

             

            It can't parse my jboss-deployment-structure.xml....

            • 3. Re: Exclude native hibernate and use user-provided hibernate
              klind

              I dropped the use of the new hibernate version, and stick with the one supplied with JBoss.

              I got it to load the new version with custom module, but there are amny dependencies to other modules that now failed.

              • 4. Re: Exclude native hibernate and use user-provided hibernate
                smarlow

                Not sure if you looked at this documentation before (I linked to it above) for how to replace the current Hibernate 4.x jars with a newer version

                 

                Also, you could try with the EAP alpha built from AS7 (latest) which has release date of 2013-03-07 (includes Hibernate 4.2.0.CR1).  If something newer shows up on that page, use that instead.

                1 of 1 people found this helpful
                • 5. Re: Exclude native hibernate and use user-provided hibernate
                  klind

                  HI Scott. I haven't seen that page before.. wish I had.

                  So it should actually be pretty easy to do. I updated to 4.1.10 and got some errors cause of some dependencies. Lokked like I had to update other modules to.

                  Anyway, I actually think we are going to use te EAP.