Why do I get javax.naming.NameNotFoundException: jdbc not bound
Issue
SCENARIO 1
- Deploying the following datasource configuration
<datasources>
<local-tx-datasource>
<jndi-name>jdbc/ContactsDS</jndi-name>
<use-java-context>false</use-java-context>...</datasources>
- Following exception is received-
Unexpected exception: javax.naming.NameNotFoundException: jdbc not bound
- When the code does the following JNDI lookup
DataSource ds = (DataSource) ctx.lookup("java:comp/env/jdbc/ContactsDS");
SCENARIO 2
- Deploying the following datasource configuration having
<use-java-context>true</use-java-context>
<datasources>
<local-tx-datasource>
<jndi-name>jdbc/ContactsDS</jndi-name>
<use-java-context>true</use-java-context>...</datasources>
- Following exception is received-
Unexpected exception: javax.naming.NameNotFoundException: jdbc/ContactsDS not bound
- When the code does the following JNDI lookup
DataSource ds = (DataSource) ctx.lookup("jdbc/ContactsDS");
Environment
- JBoss Enterprise Application Platform (EAP)
- 5.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.
