PreDestroy is not being invoked on Singleton EJB which implements SessionBean interface

Solution Verified - Updated

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 7

Issue

  • PreDestroy callback is not being invoked on Singleton EJB which implements javax.ejb.SessionBean interface.

Resolution

Do not implement javax.ejb.SessionBean interface.

Root Cause

Singleton EJB should not implement the SessionBean interface, because it is out of specification. From the Content from jcp.org is not included.EJB 3.1 specification:

The class may implement, directly or indirectly, the javax.ejb.SessionBean interface. Except for Singleton beans.
Components
Category
Tags

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.