[ 
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-4661, because the two are independent and 
the CDI work needs more review. The {{persistence-servlet.txt}} exclusion for 
{{ServletEMLookupTest}} belongs to TOMEE-4661 and must stay until that is fixed.

PR for this half: https://github.com/apache/tomee/pull/2847

  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.

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.


> 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-4661, because the two are independent and 
> the CDI work needs more review. The {{persistence-servlet.txt}} exclusion for 
> {{ServletEMLookupTest}} belongs to TOMEE-4661 and must stay until that is 
> fixed.
> PR for this half: https://github.com/apache/tomee/pull/2847



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

Reply via email to