How to ensure JNDI resources are available for application during startup/shutdown of JBoss EAP 7 / 6
Issue
-
An web application uses a
javax.servlet.ServletContextListener
to catch thecontextDestroyed
event and needs to access to a database. Attempts to obtain theDataSource
from JNDI during this process receive ajavax.naming.NameNotFoundException
indicating 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?
-
I have a HA singleton service(cluster wide) that initializes an ejb timer. To initialize the timer, I am doing a jndi look up of the ejb from HA service. This look up is randomly failing with 'Caused by: javax.naming.NameNotFoundException.
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 7.x
- 6.x
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.