8 Replies Latest reply on Jul 24, 2013 3:25 AM by Paul Baker

    Unable to deploy Hibernate 3 Web Service to JBoss AS 7.1.1.Final

    Paul Baker Apprentice

      I have read the doco and various postings about deploying a Hibernate 3 app to JBoss AS7 but I have not been able to succesfully deploy.

      The web service I'm trying to migrate to AS7 deploys/runs fine under JBoss AS6. 

       

      The webservices uses a prepackaged jar (from VisualParadigm) that contains third party persistence code and Hibernate 3.6 dependencies.

      orm-jar.jpg

       

       

      The entity classes use JPA, Hibernate, and custom annotations.

       

      Example:

       

      package com.mnat.store.datamodels.mnatinventorydata;
      @Entity
      @org.hibernate.annotations.Proxy(lazy=false)
      @Table(name="InventoryItem")
      @org.hibernate.annotations.NamedQuery(name="FND_ALL_INV_ITMS_FOR_OWNER", query="from InventoryItem inv where inv.owner = :owner")
      @com.mnat.store.utils.audit.annotations.Auditable(value=true, entityName="InventoryItem")
      public class InventoryItem extends com.mnat.store.datamodels.mnatinventorydata.common.BaseEntity implements Serializable {
       public static final String NAMED_QUERY_FND_ALL_INV_ITMS_FOR_OWNER = "FND_ALL_INV_ITMS_FOR_OWNER";
       public InventoryItem() {
       }
      ...
      ... 
       @Column(name="id", nullable=false) 
       @Id 
       @GeneratedValue(generator="COM_MNAT_STORE_DATAMODELS_MNATINVENTORYDATA_INVENTORYITEM_ID_GENERATOR") 
       @org.hibernate.annotations.GenericGenerator(name="COM_MNAT_STORE_DATAMODELS_MNATINVENTORYDATA_INVENTORYITEM_ID_GENERATOR", strategy="native") 
       private int id;
      

       

      The PersistentManager code is generated by the thirdparty tool and contains the entity configuration logic.

      I have traced this code in both AS6 and AS7 and the only noticeable difference is that the entity classes

      have the declared annotations set in the class before entering the web service logic when running in the AS6 container

      but the declared annotations are not set  in the entity classes when running in the AS7 container.  ?????

      I have attached a zip with these images in case they do not display well here.

       

      Here is an example from AS6 Debug.  Note that the declared annotations are set.

       

      JBoss AS6 Inspect Class.jpg

       

      Here is an example from AS7 Debug.

      Note the declared annotations are not set here.

      Is this the problem?

       

      JBoss AS7 Inspect Class.jpg

       

      I created a new module: org.hibernate:3

       

      <?xml version="1.0" encoding="UTF-8"?>
      <module xmlns="urn:jboss:module:1.0" name="org.hibernate" slot="3">
       <resources>
        <resource-root path="orm.jar" />
       </resources>
       <dependencies>
        <module name="org.jboss.as.jpa.hibernate" slot="3" />
        <module name="javax.api" />
        <module name="javax.transaction.api" />
        <module name="javax.validation.api" />
        <module name="org.slf4j"/>
        <module name="org.apache.commons.logging"/>
       </dependencies>
      </module>
      

       

      The orm jar contains Hiberate 3.6 classes.  See the module file attached that contains the orm.jar index.

       

      The web service does not use a persistence.xml under JBoss AS6 but I created "dummy" one for the AS7 deployment just to define:

      jboss.as.jpa.providerModule property.

       

      properties>
       <property name="jboss.as.jpa.providerModule" value="org.hibernate:3" />
       <property name="jboss.as.jpa.managed" value="false" />
      </properties>
      

       

       

      I've attached the log file which is trace level (so it's a lot of output). 

      There are two exceptions that occur when the test is run.  The first is that I get a NPE when count is attempted on the number of records in the DB (there are records). 

      I suspect that this because of the missing annotations (see above) and therefore the entities are not configured correctly.

       

       

      12:45:15,979 TRACE [org.jboss.modules] (http-localhost-127.0.0.1-8090-1) Loading class org.hibernate.criterion.RowCountProjection locally from Module "org.hibernate:3" from local module loader @6983d95 (roots: S:\JBoss\jboss-as-7.1.1.Final\modules)
      12:45:15,979 TRACE [org.jboss.modules] (http-localhost-127.0.0.1-8090-1) Attempting to define class org.hibernate.criterion.RowCountProjection in Module "org.hibernate:3" from local module loader @6983d95 (roots: S:\JBoss\jboss-as-7.1.1.Final\modules)
      12:45:15,980 TRACE [org.jboss.modules] (http-localhost-127.0.0.1-8090-1) Defined class org.hibernate.criterion.RowCountProjection in Module "org.hibernate:3" from local module loader @6983d95 (roots: S:\JBoss\jboss-as-7.1.1.Final\modules)
      12:45:15,980 TRACE [org.jboss.modules] (http-localhost-127.0.0.1-8090-1) Finding class com.mnat.store.datamodels.mnatinventorydata.InventoryItem from Module "org.jboss.as.webservices.server.integration:main" from local module loader @6983d95 (roots: S:\JBoss\jboss-as-7.1.1.Final\modules)
      12:45:15,980 TRACE [org.jboss.modules] (http-localhost-127.0.0.1-8090-1) Class com.mnat.store.datamodels.mnatinventorydata.InventoryItem not found from Module "org.jboss.as.webservices.server.integration:main" from local module loader @6983d95 (roots: S:\JBoss\jboss-as-7.1.1.Final\modules)
      12:45:15,980 TRACE [org.hibernate.jdbc.JDBCContext] (http-localhost-127.0.0.1-8090-1) after autocommit
      12:45:15,980 DEBUG [org.hibernate.jdbc.ConnectionManager] (http-localhost-127.0.0.1-8090-1) aggressively releasing JDBC connection
      12:45:15,980 TRACE [org.hibernate.impl.SessionImpl] (http-localhost-127.0.0.1-8090-1) after transaction completion
      12:45:15,980 TRACE [org.jboss.modules] (http-localhost-127.0.0.1-8090-1) Finding class org.hibernate.NonUniqueResultException from Module "org.hibernate:3" from local module loader @6983d95 (roots: S:\JBoss\jboss-as-7.1.1.Final\modules)
      12:45:15,980 TRACE [org.jboss.modules] (http-localhost-127.0.0.1-8090-1) Finding local class org.hibernate.NonUniqueResultException from Module "org.hibernate:3" from local module loader @6983d95 (roots: S:\JBoss\jboss-as-7.1.1.Final\modules)
      12:45:15,980 TRACE [org.jboss.modules] (http-localhost-127.0.0.1-8090-1) Loading class org.hibernate.NonUniqueResultException locally from Module "org.hibernate:3" from local module loader @6983d95 (roots: S:\JBoss\jboss-as-7.1.1.Final\modules)
      12:45:15,981 TRACE [org.jboss.modules] (http-localhost-127.0.0.1-8090-1) Attempting to define class org.hibernate.NonUniqueResultException in Module "org.hibernate:3" from local module loader @6983d95 (roots: S:\JBoss\jboss-as-7.1.1.Final\modules)
      12:45:15,981 TRACE [org.jboss.modules] (http-localhost-127.0.0.1-8090-1) Defined class org.hibernate.NonUniqueResultException in Module "org.hibernate:3" from local module loader @6983d95 (roots: S:\JBoss\jboss-as-7.1.1.Final\modules)
      12:45:15,983 ERROR [com.mnat.store.utils.audit.auditors.ServiceAuditor] (http-localhost-127.0.0.1-8090-1) 
      **Exception Start**
      Txn: edf6d138-9c8a-47fb-b2ee-864710f13849 Class: MNaTInventoryManagerService Method: findInventoryItems
      Exception - Type: IVMGR1000 Identifier: IVMGR10000
      User: pbaker01 Owner: 1
      ExceptionMessage: null
      Additional Info: none
      Trace Log
      java.lang.NullPointerException
       at com.mnat.store.services.mnatinventorymanager.MNaTInventoryManagerService.findInventoryItems(MNaTInventoryManagerService.java:394)
       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.ws.common.invocation.AbstractInvocationHandlerJSE.invoke(AbstractInvocationHandlerJSE.java:111)
       at org.jboss.wsf.stack.cxf.JBossWSInvoker._invokeInternal(JBossWSInvoker.java:181)
       at org.jboss.wsf.stack.cxf.JBossWSInvoker.invoke(JBossWSInvoker.java:127)
      

       

      The second set of exceptions has to to with the auditing that occurs in the web service. The service audits all requests, responses, exceptions, and DB updates.  So the exception here is  Caused by: org.hibernate.MappingException: Unknown entity: com.mnat.store.datamodels.mnatinventorymanager.audits.TransactionAudit

       

       

       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar:]
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.13.Final.jar:]
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.13.Final.jar:]
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.13.Final.jar:]
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13.Final.jar:]
       at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_27]
      Caused by: org.hibernate.MappingException: Unknown entity: com.mnat.store.datamodels.mnatinventorymanager.audits.TransactionAudit
       at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:691) [orm.jar:]
       at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1487) [orm.jar:]
       at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:202) [orm.jar:]
       at org.hibernate.event.def.AbstractSaveEventListener.getEntityState(AbstractSaveEventListener.java:531) [orm.jar:]
       at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:103) [orm.jar:]
       at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93) [orm.jar:]
       at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:687) [orm.jar:]
       at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:679) [orm.jar:]
       at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:675) [orm.jar:]
       at org.orm.PersistentSession.saveOrUpdate(PersistentSession.java:629) [orm.jar:]
       ... 49 more
      

       

      The complete trace log is attached.

       

      If I remove the persistence.xml property:

      <property name="jboss.as.jpa.managed" value="false" />

       

      I get a complete different set of exceptions related to "Infinispan".  The infispan issue.zip contains details about this.

       

      Example:

       

      13:03:31,095 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) JBAS015876: Starting deployment of "MNaTInventoryManagerService.war"
      13:03:31,651 INFO  [org.jboss.as.jpa] (MSC service thread 1-5) JBAS011401: Read persistence.xml for inventorydata_pu
      13:03:31,653 INFO  [org.jboss.as.jpa] (MSC service thread 1-5) JBAS011401: Read persistence.xml for inventorymanageraudits_pu
      13:03:31,869 WARN  [org.jboss.modules] (MSC service thread 1-4) Failed to define class org.jboss.as.jpa.hibernate3.infinispan.InfinispanRegionFactory in Module "org.jboss.as.jpa.hibernate:3" from local module loader @7eb1cc87 (roots: S:\JBoss\jboss-as-7.1.1.Final\modules): java.lang.LinkageError: Failed to link org/jboss/as/jpa/hibernate3/infinispan/InfinispanRegionFactory (Module "org.jboss.as.jpa.hibernate:3" from local module loader @7eb1cc87 (roots: S:\JBoss\jboss-as-7.1.1.Final\modules))
       at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:396) [jboss-modules.jar:1.1.1.GA]
       at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:243) [jboss-modules.jar:1.1.1.GA]
       at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:73) [jboss-modules.jar:1.1.1.GA]
       at org.jboss.modules.Module.loadModuleClass(Module.java:517) [jboss-modules.jar:1.1.1.GA]
       at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:182) [jboss-modules.jar:1.1.1.GA]
       at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.1.1.GA]
       at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) [jboss-modules.jar:1.1.1.GA]
       at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423) [jboss-modules.jar:1.1.1.GA]
       at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423) [jboss-modules.jar:1.1.1.GA]
       at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.1.1.GA]
       at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) [jboss-modules.jar:1.1.1.GA]
       at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.6.0_27]
       at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631) [rt.jar:1.6.0_27]
       at java.lang.ClassLoader.defineClass(ClassLoader.java:615) [rt.jar:1.6.0_27]
       at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) [rt.jar:1.6.0_27]
       at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:327) [jboss-modules.jar:1.1.1.GA]
       at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:391) [jboss-modules.jar:1.1.1.GA]
       at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:243) [jboss-modules.jar:1.1.1.GA]
       at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:73) [jboss-modules.jar:1.1.1.GA]
       at org.jboss.modules.Module.loadModuleClass(Module.java:517) [jboss-modules.jar:1.1.1.GA]
       at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:182) [jboss-modules.jar:1.1.1.GA]
       at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.1.1.GA]
       at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) [jboss-modules.jar:1.1.1.GA]
       at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423) [jboss-modules.jar:1.1.1.GA]
       at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.1.1.GA]
       at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) [jboss-modules.jar:1.1.1.GA]
       at org.jboss.as.jpa.hibernate3.HibernatePersistenceProviderAdaptor.<clinit>(HibernatePersistenceProviderAdaptor.java:49)
       at java.lang.Class.forName0(Native Method) [rt.jar:1.6.0_27]
       at java.lang.Class.forName(Class.java:247) [rt.jar:1.6.0_27]
       at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:345) [rt.jar:1.6.0_27]
       at java.util.ServiceLoader$1.next(ServiceLoader.java:421) [rt.jar:1.6.0_27]
       at org.jboss.as.jpa.processor.PersistenceProviderAdaptorLoader.loadPersistenceAdapterModule(PersistenceProviderAdaptorLoader.java:104)
       at org.jboss.as.jpa.processor.PersistenceUnitDeploymentProcessor.getPersistenceProviderAdaptor(PersistenceUnitDeploymentProcessor.java:467)
       at org.jboss.as.jpa.processor.PersistenceUnitDeploymentProcessor.deployPersistenceUnit(PersistenceUnitDeploymentProcessor.java:277)
       at org.jboss.as.jpa.processor.PersistenceUnitDeploymentProcessor.addPuService(PersistenceUnitDeploymentProcessor.java:258)
       at org.jboss.as.jpa.processor.PersistenceUnitDeploymentProcessor.handleWarDeployment(PersistenceUnitDeploymentProcessor.java:194)
       at org.jboss.as.jpa.processor.PersistenceUnitDeploymentProcessor.deploy(PersistenceUnitDeploymentProcessor.java:118)
       at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
       at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-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_27]
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_27]
       at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_27]
      Caused by: java.lang.NoClassDefFoundError: org/hibernate/cache/infinispan/InfinispanRegionFactory
       at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.6.0_27]
       at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631) [rt.jar:1.6.0_27]
       at java.lang.ClassLoader.defineClass(ClassLoader.java:615) [rt.jar:1.6.0_27]
       at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) [rt.jar:1.6.0_27]
       at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:327) [jboss-modules.jar:1.1.1.GA]
       at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:391) [jboss-modules.jar:1.1.1.GA]
       ... 42 more
      

       

       

      To try and manage the infinispan issue by adding "optional" to the infinispan modules wihin org.jboss.as.jpa.hibernate" slot="3".  That did not help.

       

      <!-- contains the JPA integration classes for Hibernate 3.x --> 
      <module xmlns="urn:jboss:module:1.1" name="org.jboss.as.jpa.hibernate" slot="3">
          <properties>
              <property name="jboss.api" value="private"/>
          </properties>
          <resources>
              <resource-root path="jboss-as-jpa-hibernate3-7.1.1.Final.jar"/>
              <!-- Insert resources here -->
          </resources>
          <dependencies>
              <module name="javax.annotation.api"/>
              <!-- module name="javax.persistence.api"/ -->
              <module name="javax.transaction.api"/>
              <module name="org.hibernate" slot="3" optional="true" services="import"/>  <!-- org.hibernate:3 must be created manually with Hibernate 3 jars -->
              <module name="org.hibernate.validator"/>
              <module name="org.infinispan" optional="true" />
              <module name="org.jboss.as.clustering.infinispan" optional="true" />
              <module name="org.jboss.as.jpa.spi"/>
              <module name="org.jboss.as.naming"/>
              <module name="org.jboss.as.server"/>
              <module name="org.jboss.jandex"/>
              <module name="org.jboss.logging"/>
              <module name="org.jboss.msc"/>
              <module name="org.jboss.vfs"/>
          </dependencies>
      </module>
      

       

      Any help will be greatly appreciated. I'll be happy to provide any other logs etc...  

        • 1. Re: Unable to deploy Hibernate 3 Web Service to JBoss AS 7.1.1.Final
          sgilda Newbie

          There is information about upgrading to Hibernate 4 in the JBoss EAP 6.1 Migration Guide located here: https://access.redhat.com/site/documentation/en-US/JBoss_Enterprise_Application_Platform/6.1/html-single/Migration_Guide/index.html#Update_Your_Hibernate_3_Application_to_Use_Hibernate_41

           

          If you are not able to upgrade to Hibernate 4, at the end of that section there's a topic entitled "Configure Changes for Applications That Use Hibernate and JPA" that describes steps you can take to attempt to get your Hibernate 3 application to run on JBoss.

          • 2. Re: Unable to deploy Hibernate 3 Web Service to JBoss AS 7.1.1.Final
            Paul Baker Apprentice

            sgilda,

            Thank you for your reply. 

            I had reviewed that document along with several others.  I reviewed it again and added:

            <property name="hibernate.cache.use_second_level_cache" value="false" />  

            to the persistence.xml files.
             

            <?xml version="1.0" encoding="UTF-8"?>
            <persistence xmlns="http://java.sun.com/xml/ns/persistence"
            version="1.0">
            <persistence-unit name="inventorymanageraudits_pu">
              <description>Inventory Manager Audits</description>
              <jta-data-source>java:jboss/datasources/MNaTInventoryAuditTXDS
              </jta-data-source>
              <properties>
               <property name="jboss.as.jpa.providerModule" value="org.hibernate:3" />
               <property name="hibernate.cache.use_second_level_cache" value="false" />  
               <!-- property name="jboss.as.jpa.managed" value="false" / -->
              </properties>
            </persistence-unit>
            </persistence> 

             

            But I am still getting:

             

            at org.jboss.as.jpa.processor.PersistenceUnitDeploymentProcessor.deploy(PersistenceUnitDeploymentProcessor.java:118)
            at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
            at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-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_27]
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_27]
            at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_27]
            Caused by: java.lang.NoClassDefFoundError: org/hibernate/cache/infinispan/InfinispanRegionFactory
            at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.6.0_27]
            at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631) [rt.jar:1.6.0_27]
            at java.lang.ClassLoader.defineClass(ClassLoader.java:615) [rt.jar:1.6.0_27]
            at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) [rt.jar:1.6.0_27]
            at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:327) [jboss-modules.jar:1.1.1.GA]
            at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:391) [jboss-modules.jar:1.1.1.GA]
            ... 42 more
            Caused by: java.lang.ClassNotFoundException: org.hibernate.cache.infinispan.InfinispanRegionFactory from [Module "org.jboss.as.jpa.hibernate:3" from local module loader @74f30494 (roots: S:\JBoss\jboss-as-7.1.1.Final\modules)]
            at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190) [jboss-modules.jar:1.1.1.GA]
            at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.1.1.GA]
            at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) [jboss-modules.jar:1.1.1.GA]
            at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423) [jboss-modules.jar:1.1.1.GA]
            at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423) [jboss-modules.jar:1.1.1.GA]
            at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.1.1.GA]
            at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) [jboss-modules.jar:1.1.1.GA]
            ... 48 more

            13:46:10,324 TRACE [org.jboss.modules] (MSC service thread 1-1) Finding class org.jboss.as.jpa.hibernate3.HibernatePersistenceProviderAdaptor from Module "org.jboss.as.server:main" from local module loader @74f30494 (roots: S:\JBoss\jboss-as-7.1.1.Final\modules)
            13:46:10,324 TRACE [org.jboss.modules] (MSC service thread 1-1) Class org.jboss.as.jpa.hibernate3.HibernatePersistenceProviderAdaptor not found from Module "org.jboss.as.server:main" from local module loader @74f30494 (roots: S:\JBoss\jboss-as-7.1.1.Final\modules)

             

             

            Earlier in the trace:

             

            13:46:10,097 TRACE [org.jboss.as.jpa] (MSC service thread 1-5) parse persistence.xml: reached ending persistence-unit tag
            13:46:10,098 INFO  [org.jboss.as.jpa] (MSC service thread 1-5) JBAS011401: Read persistence.xml for inventorymanageraudits_pu
            13:46:10,098 TRACE [org.jboss.as.jpa] (MSC service thread 1-5) PersistenceUnitMetadataImpl(version=1.0) [
            name: inventorymanageraudits_pu
            jtaDataSource: java:jboss/datasources/MNaTInventoryAuditTXDS
             
            nonJtaDataSource: null
            transactionType: JTA
            provider: org.hibernate.ejb.HibernatePersistence
            classes[
            ]
            packages[
            ]
            mappingFiles[
            ]
            jarFiles[
            ]
            validation-mode: AUTO
            shared-cache-mode: UNSPECIFIED
            properties[
              hibernate.cache.use_second_level_cache: false
              jboss.as.jpa.providerModule: org.hibernate:3
            ]]
            13:46:10,098 TRACE [org.jboss.as.jpa] (MSC service thread 1-5) parsed persistence unit definitions for war MNaTInventoryManagerService.war
            13:46:10,098 TRACE [org.jboss.as.jpa] (MSC service thread 1-5) incrementing PU count for MNaTInventoryManagerService.war by 2
            13:46:10,098 TRACE [org.jboss.modules] (MSC service thread 1-5) Finding class org.jboss.jandex.AnnotationInstance from Module "org.jboss.as.ee:main" from local module loader @74f30494 (roots: S:\JBoss\jboss-as-7.1.1.Final\modules)

             

            Did you have some specific thoughts with respect to the declared annotations differences?

            • 3. Re: Unable to deploy Hibernate 3 Web Service to JBoss AS 7.1.1.Final
              jaikiran pai Master

              That ClassNotFoundException appears to be related to this bug https://issues.jboss.org/browse/AS7-4313 which was fixed in a later version than 7.1.1.Final.

              • 4. Re: Unable to deploy Hibernate 3 Web Service to JBoss AS 7.1.1.Final
                Paul Baker Apprentice

                Hi jaikiran pai,

                 

                Thank you for your reply,  I installed jboss-as-8.0.0.Alpha1-SNAPSHOT and that seems to have solved the InfinispanRegionFactory issues.  Using the same conf as I used for 7.1.1.Final I don't get those exceptions anymore.   But I am left with the original recurring problem.  I get a NPE when trying to do a count of records in the DB followed by an Enity Not Found error when I try and audit that exception.

                 

                I checked my config again and noticed that I had not removed: <property name="jboss.as.jpa.managed" value="false" /> When I deploy with this property removed I now get the following exception:

                 

                05:48:23,097 INFO  [org.jboss.as.jpa] (MSC service thread 1-5) JBAS011401: Read persistence.xml for inventorydata_pu
                05:48:23,099 INFO  [org.jboss.as.jpa] (MSC service thread 1-5) JBAS011401: Read persistence.xml for inventorymanageraudits_pu
                05:48:23,380 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-8) MSC000001: Failed to start service jboss.deployment.unit."mnatinventorymanager-1.0.0.Final_JBossAS7.war".INST
                .service.StartException in service jboss.deployment.unit."mnatinventorymanager-1.0.0.Final_JBossAS7.war".INSTALL: JBAS018733: Failed to process phase INSTALL of deployment "mnatinven
                Final_JBossAS7.war"
                        at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:127) [jboss-as-server-8.0.0.Alpha1-SNAPSHOT.jar:8.0.0.Alpha1-SNAPSHOT]
                        at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1972) [jboss-msc-1.1.1.Final.jar:1.1.1.Final]
                        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1905) [jboss-msc-1.1.1.Final.jar:1.1.1.Final]
                        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_27]
                        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_27]
                        at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_27]
                Caused by: javax.persistence.PersistenceException: JBAS011466: PersistenceProvider 'org.hibernate.ejb.HibernatePersistence' not found
                        at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.lookupProvider(PersistenceUnitServiceHandler.java:582)
                        at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.deployPersistenceUnit(PersistenceUnitServiceHandler.java:313)
                        at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.addPuService(PersistenceUnitServiceHandler.java:274)
                        at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.handleWarDeployment(PersistenceUnitServiceHandler.java:189)
                        at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.deploy(PersistenceUnitServiceHandler.java:115)
                        at org.jboss.as.jpa.processor.PersistenceCompleteInstallProcessor.deploy(PersistenceCompleteInstallProcessor.java:48)
                        at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:120) [jboss-as-server-8.0.0.Alpha1-SNAPSHOT.jar:8.0.0.Alpha1-SNAPSHOT]
                        ... 5 more

                Here is my module for hibernate.

                 

                <?xml version="1.0" encoding="UTF-8"?>
                <module xmlns="urn:jboss:module:1.0" name="org.hibernate" slot="3">
                <resources>
                  <resource-root path="orm.jar" />
                </resources>
                <dependencies>
                  <module name="org.jboss.as.jpa.hibernate" slot="3" />
                  <module name="javax.api" />
                  <module name="javax.transaction.api" />
                  <module name="javax.validation.api" />
                  <module name="org.infinispan" optional="true" />
                  <module name="org.slf4j"/>
                  <module name="org.apache.commons.logging"/>
                </dependencies>
                </module>

                 

                Any idea on the PersistenceProvider 'org.hibernate.ejb.HibernatePersistence' not found exception?
                But I would really like to know the answer to this question:

                 

                In my first post on this thread I compared trace information in AS7 and AS7.  I included two screen shots. 

                In the AS7 screen shot, entities do not have annotation information (ie. declaredannotations) set but in AS6 they do.

                This information must be set by a classloader or something (annotation scanner ?) because it I don't believe it is set in my deployed code.

                Please take a look at those two screen shots. Why would entity annotation information be set for an entity in AS6 but not AS7?

                I think that this is related to my overall issue and any insight to why AS6 works one way and AS7 another may help me solve this.

                  

                Thanks in advance.

                • 5. Re: Unable to deploy Hibernate 3 Web Service to JBoss AS 7.1.1.Final
                  jaikiran pai Master

                  Paul, I haven't fully read this thread or your latest post, but:

                   

                   

                  Paul Baker wrote:

                   

                  Hi jaikiran pai,

                   

                  Thank you for your reply,  I installed jboss-as-8.0.0.Alpha1-SNAPSHOT

                  We already have WildFly 8.0.0.Alpha3 released http://wildfly.org/download/

                  • 6. Re: Unable to deploy Hibernate 3 Web Service to JBoss AS 7.1.1.Final
                    Paul Baker Apprentice

                    Hi Jaikiran,

                    Thanks again for your reply.. I will try the Alpha3 release.

                    Could take a quick glance at the two trace images at the begining of this post and let me know your thoughts on why an entity class would have "declaredAnnotatations" set in AS6 but not in AS7?

                    I'm not familiar with the process that sets the annotation class fields.  I think that my issue is related to this. Are these fields set by the classloader process?  Something else???.

                    If I could get a general understanding of this process then I could research it more.  I'm just not that familiar with it and now I'm stuck.

                     

                    Much thanks in advance..

                    • 7. Re: Unable to deploy Hibernate 3 Web Service to JBoss AS 7.1.1.Final
                      jaikiran pai Master

                      Paul Baker wrote:

                      Could take a quick glance at the two trace images at the begining of this post and let me know your thoughts on why an entity class would have "declaredAnnotatations" set in AS6 but not in AS7?

                      I'm not familiar with the process that sets the annotation class fields.  I think that my issue is related to this. Are these fields set by the classloader process?  Something else???.

                      If I could get a general understanding of this process then I could research it more.  I'm just not that familiar with it and now I'm stuck.

                       

                      The declaredAnnotations and other similar members are part of the java.lang.Class and are instantiated lazily (implementation detail) whenever any annotation information is queried on that Class instance. Take a look at the source code of java.lang.Class (for example the method getDeclaredAnnotations() which first does a initAnnotationsIfNecessary()). In short, it's all implementation details of the java.lang.Class  and I don't think that's what causing a problem. I'll take a look at this thread in a while to understand what problem you are running into.

                      • 8. Re: Unable to deploy Hibernate 3 Web Service to JBoss AS 7.1.1.Final
                        Paul Baker Apprentice

                        Thank you for replying and giving this thread some attention...
                        Let me know if you need any artifacts, logs, etc.. and I'll turn that around asap.

                        Much appreciated, Paul