1 Reply Latest reply on Mar 23, 2011 6:15 AM by Michael Litton

    AS 4.2.2GA, Hibernate and war-files

    Michael Litton Newbie

      Hi all,


      I'm having a problem isolating Hibernate in a working Tomcat 7.0.8 war-file when deploying it to JBoss AS 4.2.2 GA. I just spent and hour reading thorugh other topics like mine and testing local variations of jboss-web.xml (in WEB-INF) in order to get it to work. I also tried to include som unneeded dependencies in the application to shield it from Hibernate-internal lookups.


      Is there any texts about how to port a fully functional Spring/Hibernate webapp (*.war) to JBoss? I do not need to use any Jboss facilities and the loss of execution speed that comes with isolation is acceptable. But I must use JBoss AS 4.2.2GA.


      Any help is greatly appreciated.


      My jboss-web.xml












      The problem


      Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener

      org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jpaAuthorityRepository': Injection of persistence dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.AnnotationException: java.lang.NoSuchMethodException: org.hibernate.validator.ClassValidator.<init>(java.lang.Class, java.util.ResourceBundle, org.hibernate.validator.MessageInterpolator, java.util.Map, org.hibernate.annotations.common.reflection.ReflectionManager)

        • 1. AS 4.2.2GA, Hibernate and war-files
          Michael Litton Newbie

          I enabled logging of the class loading during the deploy attempt and searched for the ClassValidator and got


          [117724,RepositoryClassLoader,ScannerThread] loadClass org.jboss.mx.loading.UnifiedClassLoader3@2a6d5bb4{ url=file:/Users/mikelitton/Servers/jboss-4.2.2.GA/server/default/tmp/deploy/tmp5045897735863384069medcert-exp.war/ ,addedOrder=45} name=org.hibernate.validator.ClassValidator, loadClassDepth=0

          [117724,RepositoryClassLoader,ScannerThread] Loaded class from cache, org.hibernate.validator.ClassValidator@101b6d56<CodeSource: (file:/Users/mikelitton/Servers/jboss-4.2.2.GA/server/default/lib/hibernate-annotations.jar <no signer certificates>)>

          [117724,RepositoryClassLoader,ScannerThread] loadClass org.jboss.mx.loading.UnifiedClassLoader3@2a6d5bb4{ url=file:/Users/mikelitton/Servers/jboss-4.2.2.GA/server/default/tmp/deploy/tmp5045897735863384069medcert-exp.war/ ,addedOrder=45} name=org.hibernate.validator.ClassValidator class="class" org.hibernate.validator.ClassValidator cl=org.jboss.mx.loading.UnifiedClassLoader3@1fcef4f7{ url=null ,addedOrder=2}


          It exists only at one place from over 2500 loading statements during the deploy attempt.


          From what I can see it loads the class from cache (in bold), using the JBoss 4.2.2GA libraries. This is exactly what jboss-web.xml is supposed to prevent. Looking at the original file, could someone try to explain the details of it? Or point to a document where the porting process is described in detail.


          Thanks in advance!