5 Replies Latest reply on Jan 16, 2008 11:14 AM by jaikiran

    Hibernate Version Conflict in EAR File

    leandro3.marinho

      Hi People,

      I have an EAR file that contains hibernate-3.2.5.jar in the root, by my WAR file that is packaged into this EAR is using hibernate version of lib directory of the JBoss AS. How can I do the WAR uses the hibernate of EAR instead of that of lib directory of Server?

      Thanks!!

        • 1. Re: Hibernate Version Conflict in EAR File
          peterj

          Declare a loader repository for your app. To do this, in you META-INF/jboss-app.xml file (within the EAR file), add this entry:

          <jboss-app>
           ...
           <loader-repository>my.loader:loader=MyLoader</loader-repository>
           ...
          </jboss-app>


          You loader repository name is an MBean name and you can name it any name that follows MBean naming conventions.

          • 2. Re: Hibernate Version Conflict in EAR File
            leandro3.marinho

            My jboss-app.xml contains this code:

            <jboss-app>
             <loader-repository>vigisus:loader=spiv.ear</loader-repository>
            </jboss-app>
            

            I'm beginner in enterprise applications and I'm confused with this configuration.

            • 3. Re: Hibernate Version Conflict in EAR File
              jaikiran

              This configuration helps you configure a classloader for your application. This way you can use your own version of libraries (jars) instead of using the ones that are shipped in JBoss. More details can be found at :

              http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossClassLoadingUseCases

              http://wiki.jboss.org/wiki/Wiki.jsp?page=ClassLoadingConfiguration

              • 4. Re: Hibernate Version Conflict in EAR File
                leandro3.marinho

                I tried to configure it like this article, but it still doesn't work. I try too delete hibernate libs from lib directory of JBoss to assert that it will not be used. But I get follow errors:

                
                --- Incompletely deployed packages ---
                org.jboss.deployment.DeploymentInfo@85793d72 { url=file:/home/kurumin/java/tools/jboss-4.2.2.GA/server/default/deploy/spiv.ear }
                 deployer: org.jboss.deployment.EARDeployer@705d28
                 status: Deployment FAILED reason: URL file:/home/kurumin/java/tools/jboss-4.2.2.GA/server/default/tmp/deploy/tmp27285spiv.ear-contents/spiv-war-exp.war/ deployment failed
                 state: FAILED
                 watch: file:/home/kurumin/java/tools/jboss-4.2.2.GA/server/default/deploy/spiv.ear
                 altDD: null
                 lastDeployed: 1200413687430
                 lastModified: 1200413682000
                 mbeans:
                
                --- MBeans waiting for other MBeans ---
                ObjectName: jboss.j2ee:service=EJB3,module=jboss-seam-2.0.0.GA.jar
                 State: FAILED
                 Reason: java.lang.NoClassDefFoundError: org/hibernate/SessionFactory
                
                ObjectName: jboss.j2ee:service=EJB3,module=spiv-ejb-0.0.1-SNAPSHOT.jar
                 State: FAILED
                 Reason: java.lang.NoClassDefFoundError: org/hibernate/cfg/EJB3DTDEntityResolver
                
                ObjectName: jboss.web.deployment:war=spiv-war.war,id=-1428543692
                 State: FAILED
                 Reason: org.jboss.deployment.DeploymentException: URL file:/home/kurumin/java/tools/jboss-4.2.2.GA/server/default/tmp/deploy/tmp27285spiv.ear-contents/spiv-war-exp.war/ deployment failed
                
                --- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
                ObjectName: jboss.web.deployment:war=spiv-war.war,id=-1428543692
                 State: FAILED
                 Reason: org.jboss.deployment.DeploymentException: URL file:/home/kurumin/java/tools/jboss-4.2.2.GA/server/default/tmp/deploy/tmp27285spiv.ear-contents/spiv-war-exp.war/ deployment failed
                
                ObjectName: jboss.j2ee:service=EJB3,module=spiv-ejb-0.0.1-SNAPSHOT.jar
                 State: FAILED
                 Reason: java.lang.NoClassDefFoundError: org/hibernate/cfg/EJB3DTDEntityResolver
                
                ObjectName: jboss.j2ee:service=EJB3,module=jboss-seam-2.0.0.GA.jar
                 State: FAILED
                 Reason: java.lang.NoClassDefFoundError: org/hibernate/SessionFactory
                
                
                


                • 5. Re: Hibernate Version Conflict in EAR File
                  jaikiran

                  Do not delete the jar files from the server's lib folder. Post the contents of your jboss-app.xml, where you have configured the classloader for your application. Also post the exception stacktrace when you deploy your application with these configurations. In your ear file which are the hibernate jar files that you have and also where are they placed in the ear?