[ 
https://issues.apache.org/jira/browse/TOMEE-2353?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Wooster updated TOMEE-2353:
---------------------------
    Description: 
{noformat}
*no* further _formatting_ is done here{noformat}
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 

 
{code:java}
<?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>
{code}
 

 

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:
{code:java}
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.{code}
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:

 
{code:java}
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
{code}
 

  was:
{noformat}
*no* further _formatting_ is done here{noformat}
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 

 
{code:java}
<?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>
{code}
 

 

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:
{code:java}
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.{code}
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? 


> @PersistenceUnit unitName has multiple matches
> ----------------------------------------------
>
>                 Key: TOMEE-2353
>                 URL: https://issues.apache.org/jira/browse/TOMEE-2353
>             Project: TomEE
>          Issue Type: Bug
>          Components: TomEE Core Server
>            Reporter: Wooster
>            Priority: Major
>
> {noformat}
> *no* further _formatting_ is done here{noformat}
> 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 
>  
> {code:java}
> <?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>
> {code}
>  
>  
> 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:
> {code:java}
> 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.{code}
> 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:
>  
> {code:java}
> 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
> {code}
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to