title: Tomcat vs Jetty JNDI Lookup
body: <p>I use Spring to configure my Java Web App and in my Spring configuration I obtain a datasource via JNDI for Jetty as follows:</p>
  
  <p><code>&lt;jee:jndi-lookup id="dataSource" jndi-name="jdbc/myDataSource" /&gt;</code></p>
  
  <p>but this won't work with Tomcat.  With Tomcat I have to do this:</p>
  
  <p><code>&lt;jee:jndi-lookup id="dataSource" jndi-name="java:comp/env/jdbc/myDataSource" /&gt;</code></p>
  
  <p>Whats the best way to solve this?  I am already using JNDI as a way to externalize configuration, so I can't externalize my externalized configuration!  At the same time I absolutely loath the idea of having two separate Spring configuration files. HELP!!!</p>