5 Replies Latest reply on May 21, 2010 9:01 AM by chrispider

    Upgrading hibernate in JBoss 4.2.3 with with hibernate 3.5.0

      Hi,

       

      I want to upgrade hibernate in jboss 4.2.3 with hibernate 3.5.0.

       

      I have an ear like this :

       

      1. MyApp.ear 
      2. |--- META-INF 
      3. |     | 
      4. |     | 
      5. |     |--- application.xml 
      6. |     |  
      7. |     |--- jboss-app.xml 
      8. |--- [some jar files required by my app] 
      9. |      
      10. |--- hibernate3.jar
      11. |
      12. |--- hibernate-jpa-2.0-api-1.0.0.Final.jar
      13. |--- MyAppServlet.war 
      14. |--- MyAppEJB.jar


      I try to enabled classloader scoping through jboss-app.xml like this :

       

      <jboss-app>
          <loader-repository>
              org.myapp:loader=SomeClassloader 
            </loader-repository>
          <loader-repository-config>
              java2ParentDelegation=false 
          </loader-repository-config>
      </jboss-app>

       

      but im still facing a classcastexception when i start jboss :

       

      java.lang.ClassCastException: org.hibernate.ejb.HibernatePersistence cannot be cast to javax.persistence.spi.PersistenceProvider

          at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:245)

          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.ejb3.ServiceDelegateWrapper.startService(ServiceDelegateWrapper.java:103)

          at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)

          at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)

          at sun.reflect.GeneratedMethodAccessor4.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.GeneratedMethodAccessor10.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 $Proxy56.start(Unknown Source)

          at org.jboss.ejb3.JmxKernelAbstraction.install(JmxKernelAbstraction.java:120)

          at org.jboss.ejb3.Ejb3Deployment.startPersistenceUnits(Ejb3Deployment.java:627)

          at org.jboss.ejb3.Ejb3Deployment.start(Ejb3Deployment.java:351)

          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.GeneratedMethodAccessor4.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.GeneratedMethodAccessor10.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.startService(AbstractDeploymentScanner.java:336)

          at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)

          at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)

          at sun.reflect.GeneratedMethodAccessor4.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.GeneratedMethodAccessor10.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 $Proxy4.start(Unknown Source)

          at org.jboss.deployment.SARDeployer.start(SARDeployer.java:304)

          at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)

          at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)

          at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)

          at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:766)

          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.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 $Proxy5.deploy(Unknown Source)

          at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)

          at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)

          at org.jboss.Main.boot(Main.java:200)

          at org.jboss.Main$1.run(Main.java:508)

          at java.lang.Thread.run(Thread.java:619)

       

       

      I can see my loader through the jmx console but it seems like isolation not working. i also try to set up isolation in the ear-deployer.xml file. Am i missing something ?

       

      Thanks for your reply.

        • 1. Re: Upgrading hibernate in JBoss 4.2.3 with with hibernate 3.5.0
          jaikiran

          1) You should move those hibernate jars and other jars required by your app into a .ear/lib folder (except for the ejb jar and the war)

           

          2) You seem to be packaging only hibernate3.jar in your application. Does that jar have org.hibernate.ejb.* classes? I guess not. You'll have to additionally package (the right version of) the hibernate jar containing org.hibernate.ejb.* classes and any other jars that might be required.

          1 of 1 people found this helpful
          • 2. Re: Upgrading hibernate in JBoss 4.2.3 with with hibernate 3.5.0

            Concerning the second point, i package hibernate3.jar (with the org.hibernate.ejb.* classes)  and hibernate-jpa-2.0-api-1.0.0.Final.jar

            In my first post, i forgot to mention that i also package the required jar  given with the hibernate distribution :

            antlr-2.7.6.jar

            commons-collections-3.1.jar

            dom4j-1.6.1.jar

            javassist-3.9.0.GA.jar

            jta-1.1.jar

            slf4j-api-1.5.8.jar

             

            I ll try to put my jars in a lib folder.

             

            thanks.

            • 3. Re: Upgrading hibernate in JBoss 4.2.3 with with hibernate 3.5.0

              Hi,

               

              I put all the required jar in the lib folder of my ear and i still have the ClassCastException, any ideas ?

               

              When i check my class loader via the jmx console, i can see the jar from my ear/lib but i also can see all the server lib, is this normal ? I thought i only can see my own lib ?

               

               

              Thanks

              • 4. Re: Upgrading hibernate in JBoss 4.2.3 with with hibernate 3.5.0
                userdark

                i also have been trying this and getting the exact same error. the research i did so far is that jboss 4.2.3 is packaged with hibernate 3.2.4.sp1. this version of hibernate uses the orig jpa implementation defined in ejb3 (jsr-220). this version of jpa does not support native scalar queries, so i want to upgrade to hibernate 3.5. the 3.5.x version of hibernate implements the newer jpa 2.0 spec (jsr-317). so if u follow the directions and drop the new hibernate and required jars into jboss 4.2.3 the ejb3 part of jboss blow ups. so the specific error i am getting, there are new methods in javax.persistence.spi.PersistenceUnitInfo in jpa2 and do not exist in jpa1. so it looks like i now need to upgrade ejb3 to support jpa2, but if u go to the ejb3 community dev pages, they provide "ejb plugin" updates that provide "the latest bug fixes or enhancements for the community" for only jboss 5. u are screwed in u use jboss 4 since the reply to this will probably be to upgrade to jboss 5.

                1 of 1 people found this helpful
                • 5. Re: Upgrading hibernate in JBoss 4.2.3 with with hibernate 3.5.0

                  Hi,

                   

                  Thank you Frank for your response.

                  I already waste a lot of time on this, so i ll go for jboss 4.2.3 + eclipseLink until i can test a mature version of jboss 6.