[jboss-jira] [JBoss JIRA] (AS7-6871) Entity Not Mapped Exception

Scott Marlow (JIRA) jira-events at lists.jboss.org
Wed Apr 10 20:10:55 EDT 2013


    [ https://issues.jboss.org/browse/AS7-6871?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12766344#comment-12766344 ] 

Scott Marlow commented on AS7-6871:
-----------------------------------

I appreciate your wanting to report this as a bug but it really doesn't sound like one to me.  Best place to ask for help for questions like this is in the AS7 user forums.  

Try to enable TRACE logging for org.jboss.as.jpa and you should see more (helpful) information in the console during deployment. Doc link is here https://docs.jboss.org/author/display/AS72/JPA+Reference+Guide#JPAReferenceGuide-Troubleshooting

After looking at the TRACE output, you might try moving the MY-JAR-2.jar into ear/lib folder (and reference via <jar-file>MY-JAR-2.jar</jar-file>).  Having the TRACE output enabled when you make this change, will give you an idea of what is actually occurring without debugging.

I'll close this jira as there isn't a bug to fix.
                
> Entity Not Mapped Exception 
> ----------------------------
>
>                 Key: AS7-6871
>                 URL: https://issues.jboss.org/browse/AS7-6871
>             Project: Application Server 7
>          Issue Type: Feature Request
>          Components: JPA / Hibernate
>    Affects Versions: EAP 6.1.0.Alpha (7.2.0.Final)
>         Environment: Windows 7
>            Reporter: Shankar Mandal
>            Assignee: Scott Marlow
>            Priority: Blocker
>
> Entity's are not mapped with using "jar-file" in persistence.xml
> The structure of my EAR file is as under. 
> I even tried moving the persistance.xml to MYEAR\METAINF but still could not make hibernate read the entities from the jar files.
> My application is packaged in a EAR file like this
> MYEAR-
>       |
>       |__lib\
>       |	    |
>       |	    |__JPA.jar\
>       |     |         |__METAINF\
>       |     |	 .		|__persistence.xml
>       |     |__1.jar
>       |     |__2.jar
>       |     |__3.jar
>       |     
>       |
>       |__METAINF\
>       |		|__application.xml
>       |		|__jboss-app.xml
>       |		|__jboss-deployment-structure.xml
>       |
>       |
>       |__MY-JAR-1.jar
>       |__MY-JAR-2.jar
>       |__MY-JAR-3.jar
>       |__MY-JAR-4.jar
> Contents of persistence.xml is 
> <?xml version="1.0" encoding="UTF-8"?>
> <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>     xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
>     version="2.0"
> >
>     <persistence-unit name="myPU">
>         <provider>com.envista.jpa.ENPersistenceProvider</provider>
>         <!--provider>com.envista.core.persistence.ENPersistenceProvider</provider-->
>         <!--provider>org.hibernate.ejb.HibernatePersistence</provider-->
>         <jta-data-source>java:jboss/datasources/EnvistaOracleDS</jta-data-source>
>         <jar-file>../MY-JAR-1.jar</jar-file>
>         <jar-file>../MY-JAR-2.jar</jar-file>
>         <jar-file>../MY-JAR-3.jar</jar-file>
>         <jar-file>../MY-JAR-4.jar</jar-file>
>         <properties>
>             <property name="hibernate.archive.autodetection" value="class,hbm" />
>             <property name="hibernate.dialect" value="com.envista.core.hibernate.dialects.CustomOracle11gDialect" />
>             <property name="hibernate.max_fetch_depth" value="0" />
>             <property name="hibernate.default_batch_fetch_size" value="200" />
>             <property name="hibernate.show_sql" value="false" />
>             <property name="hibernate.format_sql" value="true" />
>             <property name="hibernate.search.default.directory_provider" value="org.hibernate.search.store.FSDirectoryProvider" />
>             <property name="hibernate.search.default.indexBase" value="./indexes" />
>             <property name="hibernate.search.autoregister_listeners" value="false" />
>             <property name="hibernate.search.indexing_strategy" value="event" />
>             <property name="hibernate.hbm2ddl.auto" value="${envista.db.auto}" />
>             <property name="hibernate.cache.use_second_level_cache" value="false" />
>             <property name="hibernate.cache.use_query_cache" value="false" />
>             <property name="hibernate.cache.provider_class" value="org.jboss.ejb3.entity.TreeCacheProviderHook" />
>             <property name="hibernate.treecache.mbean.object_name" value="jboss.cache:service=EJB3EntityTreeCache" />
>             <property name="hibernate.hbm2ddl.auto" value="validate"/> -->
>         </properties>
>     </persistence-unit>
>  
>  I get an error that the Entity is not mapped.
>  What I see while debugging that when hibernate is scanning the classes to register all the entities marked with @Entity 
>  in class  org.hibernate.ejb.packaging.NativeScanner.getClassesInJar(URL jarToScan, Set<Class<? extends Annotation>> annotationsToLookFor) 
> The value of jarToScan is takes the location where I run JBoss
> for e.g. if my JBOSS_INSTALLED directory is C:/Jboss6.0.1Alpha and I run the command from C:/Jboss6.0.1Alpha/bin
> C:/Jboss6.0.1Alpha/bin > standalone.bat -c standalone-full.xml
> The value of jarToScan = C:/Jboss6.0.1Alpha/bin/content/MYEAR.ear/MY-JAR-1.jar

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jboss-jira mailing list