Disclaimer: this is not a duplicate of the "why isn't my JDBC resource declared in META-INF/context.xml taken into account" genre questions.
I have two Java EE web applications:
one is created inside Eclipde IDE using Eclipse's "Web Application Project" template
the other one is created using Maven, and then imported into Eclipse
Inside Eclipse I also have a Tomcat configured using the WTP Plugin, such that I can easily (or so I hoped) deploy my Eclipse Web Apps in there in a "one button push" way.
For each of the above described applications, I have a context.xml file placed in their META-INF directory, in which I declare some JDBC datasources as JNDI resources.
The Eclipse created application works fine when deployed in the WTP Tomcat inside Eclipse. I right-click the Tomcat server in Eclipse, add the project, start it and it all works fine, the JNDI datasources are found etc.
For the other project, the one created with Maven and imported inside Eclipse, if I add it to the WTP Tomcat, and manually specify where the war file was built by Maven (in the "target" dir) it seems to work, but the JNDI datasources are not found, more specifically, my Spring declared datasource:
<jee:jndi-lookup id="dataSource" jndi-name="java:comp/env/whatever" />
throws an exception saying no JNDI name is bound for "whatever".
If I deploy the very same war file in a "regular" Tomcat (just un unzipped Tomcat, no Eclipse involved) it works fine and the JNDI datasource declared in the war's META-INF/context.xml is found.
I've looked inside Eclipse's Tomcat working dir, and sure enough while for the Eclipse created project the context.xml file is copied inside "{catalina home}\wtpwebapps\eclipeProjectName\META-INF\context.xml", there's no such file (and folder structure) for the Maven project.
My question is then: does anyone know how you can have a Maven-created web app imported inside Eclipse and deployed in WTP Tomcat such that the META-INF/context.xml file is taken into account?