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

Markus Jung updated TOMEE-4650:
-------------------------------
    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.

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.

Remove the matching lines from {{persistence-javatest.txt}} once fixed.

h2. Scope note
This issue originally also covered the missing Jakarta Persistence 3.2 CDI 
qualifier beans ({{UnsatisfiedResolutionException}} for a qualified 
{{EntityManagerFactory}} / {{EntityManager}} / {{PersistenceUnitUtil}}). That 
half has been split out into TOMEE-4658, because the two are independent and 
the CDI work needs more review. The {{persistence-servlet.txt}} exclusion for 
{{ServletEMLookupTest}} belongs to TOMEE-4658 and must stay until that is fixed.

  was:
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.

        Summary: Undeploy closes an already-closed EntityManagerFactory  (was: 
Undeploy closes an already-closed EntityManagerFactory; PU CDI qualifier beans 
missing)

> Undeploy closes an already-closed EntityManagerFactory
> ------------------------------------------------------
>
>                 Key: TOMEE-4650
>                 URL: https://issues.apache.org/jira/browse/TOMEE-4650
>             Project: TomEE
>          Issue Type: Bug
>            Reporter: Markus Jung
>            Assignee: Markus Jung
>            Priority: Major
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> 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.
> 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.
> Remove the matching lines from {{persistence-javatest.txt}} once fixed.
> h2. Scope note
> This issue originally also covered the missing Jakarta Persistence 3.2 CDI 
> qualifier beans ({{UnsatisfiedResolutionException}} for a qualified 
> {{EntityManagerFactory}} / {{EntityManager}} / {{PersistenceUnitUtil}}). That 
> half has been split out into TOMEE-4658, because the two are independent and 
> the CDI work needs more review. The {{persistence-servlet.txt}} exclusion for 
> {{ServletEMLookupTest}} belongs to TOMEE-4658 and must stay until that is 
> fixed.



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

Reply via email to