Unable to deploy Hibernate 3 Web Service to JBoss AS 7.1.1.Final
pbaker01 Jul 22, 2013 2:34 PMI 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.
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.
Here is an example from AS7 Debug.
Note the declared annotations are not set here.
Is this the problem?
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...
-
infinispan issue.zip 2.8 KB
-
hibernate-server.zip 556.7 KB
-
Debug JBoss 6 and 7JBoss.zip 1.1 MB
-
module - org.hibernate-3.zip 2.6 KB
-
orm-jar-img.zip 260.4 KB