This morning, I noticed that a JSF application running on GlassFish 4.1 throws the following error when my users exit a web application:
- WELD-000019: Error destroying null instance from managed Bean [... MyAuthenticator] with qualifiers [@Default @Named @Any]
MyAuthenticator is a javax.faces.view.ViewScoped CDI Bean with the annotated @PreDestroy method.
As a test, I removed the @PreDestroy annotation and confirmed that the error went away.
Then I added the @PreDestroy annotation back to MyAuthenticator along with many debug messages, and performed the following tests:
Test 1
- Recorded in the application.
- Out of application.
Test 2
- Recorded in the application.
- Validity of the allowed session.
Debug messages showed the following behavior in both tests:
- Created by MyAuthenticator and the login form is displayed.
- MyAuthenticator is destroyed immediately after sending the user login form and user login.
- When the session is invalid or expires, Weld will display an error message.
I believe the error is the result of Weld calling the @PreDestroy method for my already destroyed MyAuthenticator.
Questions
- Is this a bug in Weld?
- Is it safe to ignore?
source share