jpa - org.hibernate.MappingException migrating to JBoss 7 -
i migrating 2 apps jboss 5.1 eap jboss 7.1.1. applications have own databases, contain many tables have common layout. annotated entity classes these common tables defined in common.jar, resides in {jboss.server.home.url}/lib directory, , entity classes defined in application ear's persistence.xml. other app-specific entity classes packaged inside ejb jar inside ear.
since {jboss.server.home.url}/lib directory directory no longer exists in jboss7, want package common.jar inside ear's lib directory, ear looks this:
app.ear
/meta-inf/ persistence.xml manifest.mf application.xml /lib/ common.jar app-ejb.jar app.war
the persistence unit in persistence.xml defined as
<persistence-unit name="ca" transaction-type="jta"> <provider>org.hibernate.ejb.hibernatepersistence</provider> <jta-data-source>java:jboss/datasources/appds</jta-data-source> <class>com.mycorp.entity.commontable1</class> <class>com.mycorp.entity.commontable2</class> <class>com.mycorp.app.entity.appspecifictable</class> <jar-file>common.jar</jar-file> <exclude-unlisted-classes>true</exclude-unlisted-classes> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.mysql5innodbdialect" /> <property name="hibernate.hbm2ddl.auto" value="validate" /> <property name="hibernate.show_sql" value="false" /> <property name="jboss.entity.manager.factory.jndi.name" value="java:jboss/appentitymanagerfactory"/> </properties> </persistence-unit>
however, when deploy app jpa doesn't find annotated entity classes in common.jar:
18:17:02,903 trace [org.jboss.as.jpa] getclassesinjar url=/content/common.jar annotations=[interface javax.persistence.mappedsuperclass, interface javax.persistence.entity, interface javax.persistence.embeddable] 18:17:02,909 trace [org.jboss.as.jpa] no classes scan annotations in jar 'vfs:/content/common.jar' (jars classes '[vfs:/content/app.ear/lib/common.jar/, vfs:/content/app.ear/app-ejb.jar/]') 18:17:02,910 trace [org.jboss.as.jpa] getpackagesinjar url=/content/common.jar annotations=[] 18:17:02,910 trace [org.jboss.as.jpa] no classes scan annotations in jar 'vfs:/content/common.jar' (jars classes '[vfs:/content/app.ear/lib/common.jar/, vfs:/content/app.ear/app-ejb.jar/]')
and later results in "org.hibernate.mappingexception: unknown entity: com.mycorp.entity.commontable1" exception.
i'm assuming sort of classloader problem, i'm @ loss figure out how allow jpa see entity classes.
Comments
Post a Comment