0 Replies Latest reply on Oct 18, 2012 10:12 AM by Celinio Fernandes

    JBoss 7.1.1.Final: how to exclude Hibernate 4 and use the version packaged in the application ?

    Celinio Fernandes Novice

      Hi,

       

       

      My web application (WAR file) already contains Hibernate :

       

      WEB-INF\lib\hibernate-jpa-2.0-api-1.0.1.Final.jar

      WEB-INF\lib\hibernate-entitymanager-3.6.5.Final.jar

      WEB-INF\lib\hibernate-core-3.3.0.SP1.jar

      WEB-INF\lib\hibernate-commons-annotations-3.1.0.GA.jar

      WEB-INF\lib\hibernate-annotations-3.4.0.GA.jar

       

      I do not want JBoss 7.1.1.Final to load its version which is located in the folder jboss-as-7.1.1.Final\modules\org\hibernate\main

       

      I already know that i need to add the following line to the persistence.xml file :

       

      <property name="jboss.as.jpa.providerModule" value="hibernate3-bundled" />

       

      (as mentioned in https://docs.jboss.org/author/display/AS7/JPA+Reference+Guide).

       

      I get the following error when i try to deploy the WAR file :

       

      15:44:14,172 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC00001: Failed to start service jboss.de

      ployment.unit."toto-web.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."p

      etclinic-web.war".INSTALL: Failed to process phase INSTALL of deployment "toto-web.war"

              at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jb

      oss-as-server-7.1.1.Final.jar:7.1.1.Final]

              at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jbo

      ss-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$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_23]

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

              at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_23]

      Caused by: java.lang.NoClassDefFoundError: org/jboss/as/jpa/hibernate3/infinispan/SharedInfinispanRegionFactory

              at org.jboss.as.jpa.hibernate3.HibernatePersistenceProviderAdaptor.<clinit>(HibernatePersistenceProviderAda

      ptor.java:49)

              at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [rt.jar:1.6.0_23]

              at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) [rt.jar:1.6

      .0_23]

              at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) [rt

      .jar:1.6.0_23]

              at java.lang.reflect.Constructor.newInstance(Constructor.java:513) [rt.jar:1.6.0_23]

              at java.lang.Class.newInstance0(Class.java:355) [rt.jar:1.6.0_23]

              at java.lang.Class.newInstance(Class.java:308) [rt.jar:1.6.0_23]

              at org.jboss.as.jpa.processor.PersistenceProviderProcessor.deploy(PersistenceProviderProcessor.java:101)

              at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jb

      oss-as-server-7.1.1.Final.jar:7.1.1.Final]

              ... 5 more

      Caused by: java.lang.ClassNotFoundException: org.jboss.as.jpa.hibernate3.infinispan.SharedInfinispanRegionFactory f

      rom [Module "deployment.toto-web.war:main" from Service Module Loader]

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

              at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)

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

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

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

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

              ... 14 more

       

      Any idea ? something to do with Infinispan apparently. Can i turn it off ? If yes, where ?

      Thanks in advance for helping.