0 Replies Latest reply on Apr 23, 2013 7:22 PM by Daniel Bastidas

    JBoss 7.1 persistence.xml jar-file not scanned

    Daniel Bastidas Newbie

      Hi,

       

      I'm using JBoss 7.1 and trying something like this:

       

      deployments

      |-- app1.ear

      |-- app2.ear

      |-- entities1.jar

      |-- entities2.jar

      `-- persistence.jar

       

      In entities1.jar resides the domain classes of app1.ear, in entities2.jar resides the domain classes of app2.ear

      persistence.jar is the module containing the persist statements and defines the persistence unit:

       

      persistence.jar/META-INF

      |-- ejb-jar.xml

      |-- MANIFEST.MF

      |-- persistence.xml

       

      The persistence.xml file looks like this:

       

      <?xml version="1.0" encoding="UTF-8"?>
      <persistence xmlns="http://java.sun.com/xml/ns/persistence">
          <persistence-unit name="ABC">
              <jta-data-source>java:/ABC_DS</jta-data-source>
               <jar-file>entities1.jar</jar-file>
               <jar-file>entities2.jar</jar-file>
               <properties>
                   <property name="hibernate.show_sql" value="false"/>
                   <property name="hibernate.id.new_generator_mappings" value="false"/>
               </properties>
          </persistence-unit>
      </persistence>
      

       

      Here is the relevant part of the error I'm getting:

       

       

      17:41:00,550 TRACE [org.jboss.as.jpa] (MSC service thread 1-1) PersistenceUnitMetadataImpl(version=2.0) [
          name: smtt
          jtaDataSource: java:/ABC_DS
          nonJtaDataSource: null
          transactionType: JTA
          provider: org.hibernate.ejb.HibernatePersistence
          classes[
          ]
          packages[
          ]
          mappingFiles[
          ]
          jarFiles[
              entities1.jar
              entities2.jar
          ]
          validation-mode: AUTO
          shared-cache-mode: UNSPECIFIED
          properties[
              hibernate.id.new_generator_mappings: false
              hibernate.show_sql: false
          ]]
      ...
      17:41:00,931 TRACE [org.jboss.as.jpa] (MSC service thread 1-9) getClassesInJar url=/content/entities1.jar/ annotations=[interface javax.persistence.Embeddable, interface javax.persistence.MappedSuperclass, interface javax.persistence.Entity]
      17:41:00,932 TRACE [org.jboss.as.jpa] (MSC service thread 1-9) No classes to scan for annotations in jar 'vfs:/content/entities1.jar/' (jars with classes '[vfs:/content/persistence.jar/]')
      17:41:00,933 TRACE [org.jboss.as.jpa] (MSC service thread 1-9) getPackagesInJar url=/content/entities1.jar/ annotations=[]
      17:41:00,933 TRACE [org.jboss.as.jpa] (MSC service thread 1-9) No classes to scan for annotations in jar 'vfs:/content/entities1.jar/' (jars with classes '[vfs:/content/persistence.jar/]')
      17:41:00,936 TRACE [org.jboss.as.jpa] (MSC service thread 1-9) getClassesInJar url=/content/persistence.jar/ annotations=[interface javax.persistence.Embeddable, interface javax.persistence.MappedSuperclass, interface javax.persistence.Entity]
      ...
      7:44:33,911 ERROR [org.jboss.ejb3.invocation] (MSC service thread 1-4) JBAS014134: EJB Invocation failed on component com.smartmatic.persistence.service.spec.IPersistenceService for method public abstract java.util.Collection com.smartmatic.persistence.service.spec.IPersistenceService.searchObjects(com.smartmatic.persistence.search.SearchExpression,com.smartmatic.domain.user.IUser) throws com.smartmatic.lang.BaseException: org.hibernate.MappingException: Unknown entity: com.smartmatic.saes.listener.domain.demographics.device.VotingDeviceTransmissorDat
      

       

      Seeing the error "Unknown entity" makes clear that the domain entity classes of the entitiesX.jar are not scanned.

      I have also tried referencing the domain classes like <jar-file>deployment.entities1.jar</jar-file> but get the same error.

      So I'm thinking this is not possible, I mean, referencing the domain classes with the jar-file tag, if the jar files resides in the deployment folder.

      Is this possible?