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

Markus Jung updated TOMEE-4650:
-------------------------------
    Description: 
h2. Description
When a test closes a container-managed {{EntityManagerFactory}} (EMF) itself, 
TomEE's undeploy path calls {{close()}} on it again. 
{{Assembler.destroyApplication}} then fails with "Attempting to execute an 
operation on a closed EntityManagerFactory". The test method itself passes; 
only the undeploy step after it errors. TomEE must check whether the EMF is 
already closed before calling {{close()}} on it during undeploy.

Separately, TomEE does not register the CDI qualifier beans that Jakarta 
Persistence 3.2 requires for {{persistence.xml}}-declared units. When an app 
injects {{EntityManagerFactory}}, {{EntityManager}}, or {{PersistenceUnitUtil}} 
with a qualifier such as {{@CtsEm2Qualifier}}, deployment fails with 
{{UnsatisfiedResolutionException}}. TomEE is missing this part of the Jakarta 
Persistence 3.2 CDI integration.

Both problems show up on Plume (EclipseLink) and on the webprofile distribution 
(OpenJPA) alike, so neither is a persistence provider defect.

h2. Steps to reproduce / TCK reference
* 
{{ee.jakarta.tck.persistence.core.entityManagerFactoryCloseExceptions.ClientPmservletTest}}
 and {{ClientPuservletTest}} — excluded in 
{{runner-webprofile/exclusions/persistence-javatest.txt}} in the 
apache/tomee-tck harness repo. The {{exceptionsTest}} methods pass; the class 
reports an undeploy error.
* {{ee.jakarta.tck.persistence.ee.cdi.ServletEMLookupTest}} — excluded in 
{{runner-webprofile/exclusions/persistence-servlet.txt}}. Deployment fails with 
{{UnsatisfiedResolutionException}} for {{@CtsEm2Qualifier}}.

Remove the matching lines from both exclusion files once fixed.

  was:
h2. Summary
Undeploy re-closes an already-closed EntityManagerFactory, and persistence.xml 
CDI qualifier beans go unregistered.

h2. Description
When a test closes a container-managed {{EntityManagerFactory}} (EMF) itself, 
TomEE's undeploy path calls {{close()}} on it again. 
{{Assembler.destroyApplication}} then fails with "Attempting to execute an 
operation on a closed EntityManagerFactory". The test method itself passes; 
only the undeploy step after it errors. TomEE must check whether the EMF is 
already closed before calling {{close()}} on it during undeploy.

Separately, TomEE does not register the CDI qualifier beans that Jakarta 
Persistence 3.2 requires for {{persistence.xml}}-declared units. When an app 
injects {{EntityManagerFactory}}, {{EntityManager}}, or {{PersistenceUnitUtil}} 
with a qualifier such as {{@CtsEm2Qualifier}}, deployment fails with 
{{UnsatisfiedResolutionException}}. TomEE is missing this part of the Jakarta 
Persistence 3.2 CDI integration.

Both problems show up on Plume (EclipseLink) and on the webprofile distribution 
(OpenJPA) alike, so neither is a persistence provider defect.

h2. Steps to reproduce / TCK reference
* 
{{ee.jakarta.tck.persistence.core.entityManagerFactoryCloseExceptions.ClientPmservletTest}}
 and {{ClientPuservletTest}} — excluded in 
{{runner-webprofile/exclusions/persistence-javatest.txt}} in the 
apache/tomee-tck harness repo. The {{exceptionsTest}} methods pass; the class 
reports an undeploy error.
* {{ee.jakarta.tck.persistence.ee.cdi.ServletEMLookupTest}} — excluded in 
{{runner-webprofile/exclusions/persistence-servlet.txt}}. Deployment fails with 
{{UnsatisfiedResolutionException}} for {{@CtsEm2Qualifier}}.

Remove the matching lines from both exclusion files once fixed.


> Undeploy closes an already-closed EntityManagerFactory; PU CDI qualifier 
> beans missing
> --------------------------------------------------------------------------------------
>
>                 Key: TOMEE-4650
>                 URL: https://issues.apache.org/jira/browse/TOMEE-4650
>             Project: TomEE
>          Issue Type: Bug
>            Reporter: Markus Jung
>            Priority: Major
>
> h2. Description
> When a test closes a container-managed {{EntityManagerFactory}} (EMF) itself, 
> TomEE's undeploy path calls {{close()}} on it again. 
> {{Assembler.destroyApplication}} then fails with "Attempting to execute an 
> operation on a closed EntityManagerFactory". The test method itself passes; 
> only the undeploy step after it errors. TomEE must check whether the EMF is 
> already closed before calling {{close()}} on it during undeploy.
> Separately, TomEE does not register the CDI qualifier beans that Jakarta 
> Persistence 3.2 requires for {{persistence.xml}}-declared units. When an app 
> injects {{EntityManagerFactory}}, {{EntityManager}}, or 
> {{PersistenceUnitUtil}} with a qualifier such as {{@CtsEm2Qualifier}}, 
> deployment fails with {{UnsatisfiedResolutionException}}. TomEE is missing 
> this part of the Jakarta Persistence 3.2 CDI integration.
> Both problems show up on Plume (EclipseLink) and on the webprofile 
> distribution (OpenJPA) alike, so neither is a persistence provider defect.
> h2. Steps to reproduce / TCK reference
> * 
> {{ee.jakarta.tck.persistence.core.entityManagerFactoryCloseExceptions.ClientPmservletTest}}
>  and {{ClientPuservletTest}} — excluded in 
> {{runner-webprofile/exclusions/persistence-javatest.txt}} in the 
> apache/tomee-tck harness repo. The {{exceptionsTest}} methods pass; the class 
> reports an undeploy error.
> * {{ee.jakarta.tck.persistence.ee.cdi.ServletEMLookupTest}} — excluded in 
> {{runner-webprofile/exclusions/persistence-servlet.txt}}. Deployment fails 
> with {{UnsatisfiedResolutionException}} for {{@CtsEm2Qualifier}}.
> Remove the matching lines from both exclusion files once fixed.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to