Uploaded image for project: 'TomEE'
  1. TomEE
  2. TOMEE-2353

@PersistenceUnit unitName has multiple matches

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • TomEE Core Server
    • None

    Description

      On 8.0.0-M1

      I am trying to deploy a shaded WAR as described in https://www.tomitribe.com/blog/50-shades-of-tomee/

      I have a simple persistence.xml 

       

      <?xml version="1.0" encoding="UTF-8"?> <persistence version="2.0" 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"> <persistence-unit name="CRMServicePU" transaction-type="JTA"> <jta-data-source>jdbc/crmservice</jta-data-source> <non-jta-data-source>jdbc/nonJTAcrmService</non-jta-data-source> <exclude-unlisted-classes>false</exclude-unlisted-classes> <shared-cache-mode>ALL</shared-cache-mode> </persistence-unit> </persistence>
      

       

       

      And a tomee.xml config file that connects up jdbc/crmservice to postgresql. Persistence.xml lives in webapp/WEB-INF

      I have ensured exactly one copy of persistence.xml is present in the build, yet it keeps creating multiple copies of the PU:

      INFO - Configuring Service(id=Default Singleton Container, type=Container, provider-id=Default Singleton Container)
      INFO - Auto-creating a container for bean AutoTaskStats: Container(type=SINGLETON, id=Default Singleton Container)
      INFO - Creating Container(id=Default Singleton Container)
      INFO - Configuring Service(id=Default Stateless Container, type=Container, provider-id=Default Stateless Container)
      INFO - Auto-creating a container for bean ContractBean: Container(type=STATELESS, id=Default Stateless Container)
      INFO - Creating Container(id=Default Stateless Container)
      INFO - Configuring Service(id=Default Managed Container, type=Container, provider-id=Default Managed Container)
      INFO - Auto-creating a container for bean CRMService-2.0.Comp954997812: Container(type=MANAGED, id=Default Managed Container)
      INFO - Creating Container(id=Default Managed Container)
      INFO - Using directory /var/folders/n8/rmzyc9yx2zvbc978_p6y_by40000gn/T for stateful session passivation
      INFO - Configuring PersistenceUnit(name=CRMServicePU)
      INFO - Auto-creating a Resource with id 'jdbc/crmserviceNonJtaNonJta' of type 'DataSource for 'CRMServicePU'.
      INFO - Configuring Service(id=jdbc/crmserviceNonJtaNonJta, type=Resource, provider-id=jdbc/crmserviceNonJta)
      INFO - Creating Resource(id=jdbc/crmserviceNonJtaNonJta)
      INFO - Adjusting PersistenceUnit CRMServicePU <jta-data-source> to Resource ID 'jdbc/crmserviceNonJta' from 'jdbc/crmservice'
      INFO - Adjusting PersistenceUnit CRMServicePU <non-jta-data-source> to Resource ID 'jdbc/crmserviceNonJtaNonJta' from 'jdbc/nonJTAcrmService'
      INFO - Configuring PersistenceUnit(name=CRMServicePU)
      INFO - Adjusting PersistenceUnit CRMServicePU <jta-data-source> to Resource ID 'jdbc/crmserviceNonJta' from 'jdbc/crmservice'
      INFO - Adjusting PersistenceUnit CRMServicePU <non-jta-data-source> to Resource ID 'jdbc/crmserviceNonJtaNonJta' from 'null'
      INFO - Configuring PersistenceUnit(name=CRMServicePU)
      INFO - Adjusting PersistenceUnit CRMServicePU <jta-data-source> to Resource ID 'jdbc/crmserviceNonJta' from 'jdbc/crmservice'
      INFO - Adjusting PersistenceUnit CRMServicePU <non-jta-data-source> to Resource ID 'jdbc/crmserviceNonJtaNonJta' from 'null'
      SEVERE - FAIL ... CRMService-2.0: @PersistenceUnit unitName has multiple matches: unitName "CRMServicePU" has 3 possible matches.
      SEVERE - FAIL ... CRMService-2.0: @PersistenceUnit unitName has multiple matches: unitName "CRMServicePU" has 3 possible matches.
      SEVERE - FAIL ... CRMService-2.0: @PersistenceUnit unitName has multiple matches: unitName "CRMServicePU" has 3 possible matches.
      SEVERE - FAIL ... CRMService-2.0: @PersistenceUnit unitName has multiple matches: unitName "CRMServicePU" has 3 possible matches.
      SEVERE - FAIL ... CRMService-2.0: @PersistenceUnit unitName has multiple matches: unitName "CRMServicePU" has 3 possible matches.
      SEVERE - FAIL ... CRMService-2.0: @PersistenceUnit unitName has multiple matches: unitName "CRMServicePU" has 3 possible matches.
      SEVERE - FAIL ... CRMService-2.0: @PersistenceUnit unitName has multiple matches: unitName "CRMServicePU" has 3 possible matches.
      SEVERE - FAIL ... CRMService-2.0: @PersistenceUnit unitName has multiple matches: unitName "CRMServicePU" has 3 possible matches.
      SEVERE - FAIL ... CRMService-2.0: @PersistenceUnit unitName has multiple matches: unitName "CRMServicePU" has 3 possible matches.
      SEVERE - FAIL ... CRMService-2.0: @PersistenceUnit unitName has multiple matches: unitName "CRMServicePU" has 3 possible matches.

      I am quite sure there is only one persistence.xml file in the built shaded war. When I execute it, the file can be found at 

      `./target/CRMService-2.0/WEB-INF/persistence.xml`

      What am I doing wrong? 

       

       

      With VERBOSE:

       

      SEVERE - FAIL ... CRMService-2.0: The reference @PersistenceUnit(name="emf", unitName="CRMServicePU") cannot be resolved as there are 3 units with the same name.  Update your unitName to one of the following:../CRMServicePU%20-1416073382localhost
      ../CRMServicePU%20-164941935localhost
      ../CRMServicePU%2028475843localhost
      

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            wooster Wooster
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: