How to ensure JNDI resources are available for application during startup/shutdown of JBoss EAP 6?
Issue
-
An web application uses a
javax.servlet.ServletContextListenerto catch thecontextDestroyedevent and needs to access to a database. Attempts to obtain theDataSourcefrom JNDI during this process receive ajavax.naming.NameNotFoundExceptionindicating that the JNDI repository does not contain theDataSource. -
Is it possible to configure the datasource such that when the JBoss is shut down, then, first the application is disabled/undeployed and then the DataSource will be shutdown?
- How do I ensure a resource in JNDI is available during startup or shutdown of an application?
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 6.x
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
