I am doing a Jndi look up using <jee:jndi-lookup>
. Everything works fine but as per the Jndi resource reference in Tomcat site , we need the <resource-ref>
in Web.xml . I am not able to understand why we need this. Everything works fine if I have a context.xml under the conf folder without the web.xml definitions .
My question is whether <resource-ref>
is required only when we lookup Jndi through plain Java code(InitialContext().lookup("...")
) and not via Spring .I am not sure if we need this here also.
I saw a discussion on this at What is resource-ref in web.xml used for? but the configuration below
<resource-ref>
<res-ref-name>jdbc/primaryDB</res-ref-name>
<jndi-name>jdbc/PrimaryDBInTheContainer</jndi-name>
</resource-ref>
does not seem to work as stated when I use it in the application's web.xml(under WEB-INF) . I think it's specific to JBoss web.xml. Please help me understand .