KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Is there any method to prevent a Java EE application from starting if an exception occurs during application initialization? I'm basically looking for a way to cause the application to enter a " j2ee.state.failed " state (per JSR-77 ) following an unhandled exception thrown from a ServletContextListener or a Singleton Startup bean during application initialization. The EJB specification seems to indicate that if an exception occurs during initialization of a Singleton bean, the application will continue to start and run without error; however, only the bean itself may be in a state where it cannot be invoked. Unfortunately, this is not the behavior that I'm looking for. 4.8.4 Singleton Error Handling Errors occurring during Singleton initialization are considered fatal and must result in the discarding of the Singleton instance. Possible initialization errors include injection failure, a system exception thrown from a PostConstruct method, or the failure of a PostConstruct method container-managed transaction to successfully commit. If a singleton fails to initialize, attempted invocations on the Singleton result in an exception as defined by Section 3.4.3 and Section 3.4.4. The Servlet specification is a bit more ambiguous in its requirements, seemingly not requiring a container to behave in a
Tags (comma-separated)
Save Edits
Cancel