[GLASSFISH-19298] EJB bean class PreDestroy method not called after system exception in business method Created: 06/Nov/12  Updated: 15/May/13  Resolved: 15/May/13

Status: Resolved
Project: glassfish
Component/s: ejb_container
Affects Version/s:, 4.0_b61
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Cheng Fang Assignee: marina vatkina
Resolution: Works as designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File test.war    


A RuntimeException occurred in the business method of a stateless bean. As a system exception it will cause the bean instance to be destroyed, and its PreDestroy method invoked.

When running it on and 4 trunk build, I don't see the pre-destroy methos to be called. So it could be the bean instance is not destroyed, or it is destroyed but didn't call pre-destroy method.

Comment by Cheng Fang [ 06/Nov/12 ]

To run the test app, after deploying test.war:

curl http://localhost:8080/test/

check server.log for entries for PostConstruct and PreDestroy, the latter is not present.

Comment by marina vatkina [ 15/May/13 ]

Per EJB 3.2 spec section "4.6.4 Missed PreDestroy Calls"

The following scenarios result in the PreDestroy lifecycle callback interceptor method(s) not being called for an instance:

•A system exception thrown from the instance's method to the container.

Generated at Sat Oct 10 14:59:12 UTC 2015 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.