8 Replies Latest reply on Jan 17, 2008 9:49 AM by Pete Muir

    Seam with Hibernate Version Conflict

    virgulino ferreira Newbie

      Hi Folks,

      I'm using Seam 2.0.0.GA running in JBoss 4.2.2.GA and I'm with a problem of hibernate version conflict. I have packaged hibernate, hibernate-annotations and hibernate-validator in my ear file, but Seam is using hibernate version of the server lib directory. How can I do Seam use hibernate of my ear instead of hibernate of server lib?

      hibernate, hibernate annotations, hibernate validator, my ejb-jar and my war files is in ear root.

      I think my ejb-jar is using hibernate of ear, and my war file is using hibernate of server libs.

      Can somebody help-me?

      Thanks!!

        • 1. Re: Seam with Hibernate Version Conflict
          Nicklas Karlsson Master

          Do you have any Class-Path: entries in your war META-INF MANIFEST.MF?

          • 3. Re: Seam with Hibernate Version Conflict
            Monkey Den Master

            Have your jar files been added to application.xml?

            • 4. Re: Seam with Hibernate Version Conflict
              virgulino ferreira Newbie

              Follow my application.xml:

              <application>
               <display-name>spiv-ear</display-name>
               <module>
               <web>
               <web-uri>spiv-war.war</web-uri>
               <context-root>spiv</context-root>
               </web>
               </module>
               <module>
               <ejb>spiv-ejb-0.0.1-SNAPSHOT.jar</ejb>
               </module>
               <module>
               <ejb>jboss-seam-2.0.0.GA.jar</ejb>
               </module>
               <module>
               <java>hibernate-3.2.5.ga.jar</java>
               </module>
               <module>
               <java>hibernate-annotations-3.3.0.ga.jar</java>
               </module>
               <module>
               <java>hibernate-validator-3.0.0.GA.jar</java>
               </module>
              
              </application>
              

              If I remove the hibernate files of lib directory of JBoss AS, I get this exception when I try load my app.
              java.lang.NoClassDefFoundError: org/hibernate/cfg/EJB3DTDEntityResolver
               at org.jboss.ejb3.Ejb3Deployment.initializePersistenceUnits(Ejb3Deployment.java:535)
               at org.jboss.ejb3.Ejb3Deployment.create(Ejb3Deployment.java:329)
               at org.jboss.ejb3.Ejb3Module.createService(Ejb3Module.java:77)
               at org.jboss.system.ServiceMBeanSupport.jbossInternalCreate(ServiceMBeanSupport.java:260)
               at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:243)
               at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
               at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
               at java.lang.reflect.Method.invoke(Method.java:597)
               at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
               at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
               at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
               at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
               at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
               at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
               at $Proxy0.create(Unknown Source)
               at org.jboss.system.ServiceController.create(ServiceController.java:330)
               at org.jboss.system.ServiceController.create(ServiceController.java:273)
               at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
               at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
               at java.lang.reflect.Method.invoke(Method.java:597)
               at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
               at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
               at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
               at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
               at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
               at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
               at $Proxy33.create(Unknown Source)
               at org.jboss.ejb3.EJB3Deployer.create(EJB3Deployer.java:492)
               at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
               at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
               at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
               at java.lang.reflect.Method.invoke(Method.java:597)
               at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
               at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
               at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
               at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
               at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
               at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
               at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
               at org.jboss.wsf.container.jboss42.DeployerInterceptor.create(DeployerInterceptor.java:76)
               at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.create(SubDeployerInterceptorSupport.java:180)
               at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:91)
               at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
               at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
               at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
               at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
               at $Proxy34.create(Unknown Source)
               at org.jboss.deployment.MainDeployer.create(MainDeployer.java:969)
               at org.jboss.deployment.MainDeployer.create(MainDeployer.java:959)
               at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:818)
               at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
               at sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)
               at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
               at java.lang.reflect.Method.invoke(Method.java:597)
               at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
               at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
               at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
               at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
               at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
               at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
               at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
               at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
               at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
               at $Proxy9.deploy(Unknown Source)
               at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
               at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
               at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
               at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:274)
               at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:225)
              14:25:38,134 WARN [ServiceController] Problem starting service jboss.j2ee:service=EJB3,module=jboss-seam-2.0.0.GA.jar
              java.lang.NoClassDefFoundError: org/hibernate/SessionFactory
               at org.jboss.ejb3.EJBContainer.processMetadata(EJBContainer.java:347)
               at org.jboss.ejb3.SessionContainer.processMetadata(SessionContainer.java:140)
               at org.jboss.ejb3.Ejb3Deployment.processEJBContainerMetadata(Ejb3Deployment.java:292)
               at org.jboss.ejb3.Ejb3Deployment.start(Ejb3Deployment.java:356)
               at org.jboss.ejb3.Ejb3Module.startService(Ejb3Module.java:91)
               at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
               at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
               at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
               at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
               at java.lang.reflect.Method.invoke(Method.java:597)
               at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
               at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
               at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
               at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
               at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
               at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
               at $Proxy0.start(Unknown Source)
               at org.jboss.system.ServiceController.start(ServiceController.java:417)
               at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
               at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
               at java.lang.reflect.Method.invoke(Method.java:597)
               at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
               at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
               at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
               at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
               at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
               at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
               at $Proxy33.start(Unknown Source)
               at org.jboss.ejb3.EJB3Deployer.start(EJB3Deployer.java:512)
               at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
               at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
               at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
               at java.lang.reflect.Method.invoke(Method.java:597)
               at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
               at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
               at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
               at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
               at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
               at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
               at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
               at org.jboss.wsf.container.jboss42.DeployerInterceptor.start(DeployerInterceptor.java:87)
               at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)
               at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
               at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
               at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
               at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
               at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
               at $Proxy34.start(Unknown Source)
               at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
               at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1015)
               at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
               at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
               at sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)
               at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
               at java.lang.reflect.Method.invoke(Method.java:597)
               at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
               at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
               at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
               at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
               at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
               at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
               at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
               at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
               at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
               at $Proxy9.deploy(Unknown Source)
               at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
               at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
               at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
               at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:274)
               at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:225)
              
              


              • 5. Re: Seam with Hibernate Version Conflict
                virgulino ferreira Newbie

                Hi people,

                I try put hibernate in the lib directory in the EAR, but Seam insists to use that of the server lib directory. Can somebody help me to solve this problem?

                • 7. Re: Seam with Hibernate Version Conflict
                  virgulino ferreira Newbie

                  I just have tried these configurations too, but don't work. I tried delete hibernate jars of server lib directory but it don't work too, my application don't recognizes the libs into ear and throws exceptions and show this in the server console:

                  
                  --- 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@168989e
                   status: Deployment FAILED reason: URL file:/home/kurumin/java/tools/jboss-4.2.2.GA/server/default/tmp/deploy/tmp65581spiv.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: 1200424791209
                   lastModified: 1200424787000
                   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=-236867335
                   State: FAILED
                   Reason: org.jboss.deployment.DeploymentException: URL file:/home/kurumin/java/tools/jboss-4.2.2.GA/server/default/tmp/deploy/tmp65581spiv.ear-contents/spiv-war-exp.war/ deployment failed
                  
                  --- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
                  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
                  
                  ObjectName: jboss.web.deployment:war=spiv-war.war,id=-236867335
                   State: FAILED
                   Reason: org.jboss.deployment.DeploymentException: URL file:/home/kurumin/java/tools/jboss-4.2.2.GA/server/default/tmp/deploy/tmp65581spiv.ear-contents/spiv-war-exp.war/ deployment failed
                  
                  


                  • 8. Re: Seam with Hibernate Version Conflict
                    Pete Muir Master

                    You would be much better off asking this in e.g. the EJB3 forum, as this is a JBoss AS/EAR packaging question, not Seam.