11 Replies Latest reply on Jan 8, 2013 10:48 PM by Viet Tran

    Hibernate 3.3 support

    Nicolai Ødum Newbie

      Hello

       

      The current guide for using hibernate3 actually only works on hibernate 3.5 and forward. I am trying to port a major application to JBoss7 and we depend on hibernate 3.3.2 and are not able to upgrade to hibernate.

      If I follow the guide that should enable hibernate 3 support and use the following module.xml

       

      <module xmlns="urn:jboss:module:1.0" name="org.hibernate" slot="3">

          <resources>

              <resource-root path="hibernate-3.3.2.jar"/>

              <resource-root path="hibernate-annotations-3.4.0.jar"/>

              <resource-root path="hibernate-commons-annotations-3.3.1.jar"/>

              <resource-root path="hibernate-entitymanager-3.4.0.jar"/>

              <resource-root path="hibernate-validator-3.1.0.jar"/>

              <resource-root path="javassist-3.12.0.GA.jar"/>

              <resource-root path="antlr-2.7.6.jar"/> 

              <resource-root path="commons-collections-3.2.1.jar"/> 

              <resource-root path="dom4j-1.6.1.jar"/> 

              <resource-root path="jta-1.1.jar"/> 

              <!-- Insert other Hibernate 3 jars to be used here -->

          </resources>

       

          <dependencies>

              <module name="org.jboss.as.jpa.hibernate" slot="3"/>

              <module name="asm.asm"/>

              <module name="javax.api"/>

              <module name="javax.persistence.api"/>

              <module name="javax.transaction.api"/>

              <module name="javax.validation.api"/>

              <module name="org.slf4j"/>

              <module name="org.apache.ant"/>

              <module name="org.infinispan"/>

              <module name="org.javassist"/>

          </dependencies>

      </module>

       

      But when I use the module I get the follow error

       

      Caused by: java.lang.NoClassDefFoundError: org/hibernate/ejb/packaging/Scanner

          at java.lang.ClassLoader.defineClass1(Native Method) [:1.6.0_26]

          at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631) [:1.6.0_26]

          at java.lang.ClassLoader.defineClass(ClassLoader.java:615) [:1.6.0_26]

          at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) [:1.6.0_26]

          at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:397)

       

      And when reading the hibernate doc it turns out that Scanner is a Hibernate 3.5 class - so my question is:

       

      Is hibernate 3.3.x support planned?

        • 1. Re: Hibernate 3.3 support
          Scott Marlow Master

          Hello,

           

          Thanks for catching this bug.  I just updated the documentation. 

           

          I'm not against there being support for Hibernate 3.3.  Could you provide more of the exception call stack?

          • 2. Re: Hibernate 3.3 support
            Nicolai Ødum Newbie

            Hello Scott

             

            Sure :-) Here goes

             

            08:34:49,678 INFO  [org.jboss.jpa] (MSC service thread 1-2) starting Persistence Unit Service 'integration.ear#integration'

            08:34:49,690 WARN  [org.jboss.modules] (MSC service thread 1-2) Failed to define class org.jboss.as.jpa.hibernate3.HibernateAnnotationScanner in Module "org.jboss.as.jpa.hibernate:3" from local module loader @8acf6e (roots: C:\TEMP\jboss-as-7.1.0.Alpha1-SNAPSHOT_old\modules): java.lang.LinkageError: Failed to link org/jboss/as/jpa/hibernate3/HibernateAnnotationScanner (Module "org.jboss.as.jpa.hibernate:3" from local module loader @8acf6e (roots: C:\TEMP\jboss-as-7.1.0.Alpha1-SNAPSHOT_old\modules))

                at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:401)

                at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:261)

                at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:76)

                at org.jboss.modules.Module.loadModuleClass(Module.java:588)

                at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:183)

                at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:358)

                at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:330)

                at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:307)

                at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:101)

                at org.jboss.as.jpa.hibernate3.HibernatePersistenceProviderAdaptor.beforeCreateContainerEntityManagerFactory(HibernatePersistenceProviderAdaptor.java:97)

                at org.jboss.as.jpa.service.PersistenceUnitService.createContainerEntityManagerFactory(PersistenceUnitService.java:166)

                at org.jboss.as.jpa.service.PersistenceUnitService.start(PersistenceUnitService.java:80)

                at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1765)

                at org.jboss.msc.service.ServiceControllerImpl$ClearTCCLTask.run(ServiceControllerImpl.java:2291)

                at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_26]

                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_26]

                at java.lang.Thread.run(Thread.java:662) [:1.6.0_26]

            Caused by: java.lang.NoClassDefFoundError: org/hibernate/ejb/packaging/Scanner

                at java.lang.ClassLoader.defineClass1(Native Method) [:1.6.0_26]

                at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631) [:1.6.0_26]

                at java.lang.ClassLoader.defineClass(ClassLoader.java:615) [:1.6.0_26]

                at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) [:1.6.0_26]

                at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:397)

                ... 16 more

            Caused by: java.lang.ClassNotFoundException: org.hibernate.ejb.packaging.Scanner from [Module "org.jboss.as.jpa.hibernate:3" from local module loader @8acf6e (roots: C:\TEMP\jboss-as-7.1.0.Alpha1-SNAPSHOT_old\modules)]

                at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:191)

                at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:358)

                at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:330)

                at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:330)

                at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:307)

                at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:101)

                ... 21 more

             

            08:34:50,037 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC00001: Failed to start service jboss.persistenceunit."integration.ear#integration": org.jboss.msc.service.StartException in service jboss.persistenceunit."integration.ear#integration": Failed to start service

                at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1786)

                at org.jboss.msc.service.ServiceControllerImpl$ClearTCCLTask.run(ServiceControllerImpl.java:2291)

                at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_26]

                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_26]

                at java.lang.Thread.run(Thread.java:662) [:1.6.0_26]

            Caused by: java.lang.LinkageError: Failed to link org/jboss/as/jpa/hibernate3/HibernateAnnotationScanner (Module "org.jboss.as.jpa.hibernate:3" from local module loader @8acf6e (roots: C:\TEMP\jboss-as-7.1.0.Alpha1-SNAPSHOT_old\modules))

                at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:401)

                at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:261)

                at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:76)

                at org.jboss.modules.Module.loadModuleClass(Module.java:588)

                at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:183)

                at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:358)

                at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:330)

                at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:307)

                at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:101)

                at org.jboss.as.jpa.hibernate3.HibernatePersistenceProviderAdaptor.beforeCreateContainerEntityManagerFactory(HibernatePersistenceProviderAdaptor.java:97)

                at org.jboss.as.jpa.service.PersistenceUnitService.createContainerEntityManagerFactory(PersistenceUnitService.java:166)

                at org.jboss.as.jpa.service.PersistenceUnitService.start(PersistenceUnitService.java:80)

                at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1765)

                ... 4 more

            Caused by: java.lang.NoClassDefFoundError: org/hibernate/ejb/packaging/Scanner

                at java.lang.ClassLoader.defineClass1(Native Method) [:1.6.0_26]

                at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631) [:1.6.0_26]

                at java.lang.ClassLoader.defineClass(ClassLoader.java:615) [:1.6.0_26]

                at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) [:1.6.0_26]

                at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:397)

                ... 16 more

            Caused by: java.lang.ClassNotFoundException: org.hibernate.ejb.packaging.Scanner from [Module "org.jboss.as.jpa.hibernate:3" from local module loader @8acf6e (roots: C:\TEMP\jboss-as-7.1.0.Alpha1-SNAPSHOT_old\modules)]

                at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:191)

                at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:358)

                at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:330)

                at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:330)

                at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:307)

                at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:101)

                ... 21 more

            • 3. Re: Hibernate 3.3 support
              Scott Marlow Master

              Are you interested in helping to build an "org.jboss.as.jpa.hibernate:3_3" integration module?  It would  mostly be a clone of the hibernate3 folder in https://github.com/jbossas/jboss-as/tree/master/jpa.

              • 4. Re: Hibernate 3.3 support
                Nicolai Ødum Newbie

                Of course :-)

                 

                Tell me when there is something I can try out

                • 5. Re: Hibernate 3.3 support
                  Scott Marlow Master

                  Nicolai,

                   

                  I'm ready for your help with trying again with the hibernate-3.3.2.jar.  The NoClassDefFoundError on org.hibernate.ejb.packaging.Scanner will be ignored (will show up in server.log but ignore that also).  Since the Scanner is how we are currently scanning entity classes for annotations, the entity class names should instead be specified in the persistence.xml.  Perhaps we can do better than that in the future but this is a start.

                   

                  The support for this, should show up in the nightly build (see http://community.jboss.org/thread/167590) starting tomorrow.

                   

                  To see an example unit test (includes the persistence.xml) that worked with this change, see https://github.com/jbossas/jboss-as/blob/master/testsuite/compat/src/test/java/org/jboss/as/testsuite/compat/jpa/hibernate/Hibernate3SharedModuleProviderTestCase.java

                   

                  Keep in mind that Hibernate 3.3.2 is JPA 1 based, so not all EntityManager operations will work.

                   

                  Write back to describe your results.

                   

                  Scott

                  • 6. Re: Hibernate 3.3 support
                    Nicolai Ødum Newbie

                    Hello Scott

                     

                    I will download nightly build and test it - unfortunally my test will not be very good because I am waiting on another bug https://issues.jboss.org/browse/AS7-1523 before I can deploy my application correct.

                    • 7. Re: Hibernate 3.3 support
                      Dave seenam Newbie

                      Hey Nicolai, were you able to get past this issue ?

                      • 8. Re: Hibernate 3.3 support
                        arjun e Newbie

                        Hi Nicolai, were you able to solve this issue ?

                        • 9. Re: Hibernate 3.3 support
                          Viet Tran Newbie

                          Hi Nicolai,

                           

                          Do you have any update on this?

                          • 10. Re: Hibernate 3.3 support
                            Nicolai Ødum Newbie

                            Hello

                             

                            The task has been cancelled by my Boss - so I am not able to verify if the fix works or not :-(

                            • 11. Re: Hibernate 3.3 support
                              Viet Tran Newbie

                              Hi Nicolai, thanks for your update.