title: External properties loader with Tomcat server
body: <p>I am trying to deploy a spring mvc webapp into a tomcat server. I have been testing locally using the maven-jetty-plugin. In my spring configuration I am using a properties placeholder, and pulling my properties from an external file:</p>
  
  <pre><code>&lt;context:property-placeholder ignore-resource-not-found="true" ignore-unresolvable="true"/&gt;
  &lt;bean id="modelPropertyPlaceholder" class="org.springframework.web.context.support.ServletContextPropertyPlaceholderConfigurer"&gt;
      &lt;property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE"/&gt;
      &lt;property name="searchContextAttributes" value="true"/&gt;
      &lt;property name="contextOverride" value="true"/&gt;
      &lt;property name="ignoreResourceNotFound" value="true"/&gt;
      &lt;property name="ignoreUnresolvablePlaceholders" value="true"/&gt;
      &lt;property name="locations"&gt;
          &lt;list&gt;
              &lt;value&gt;classpath:default.model.properties&lt;/value&gt;
              &lt;value&gt;file:/etc/app/app.properties&lt;/value&gt;
              &lt;value&gt;${config}&lt;/value&gt;
          &lt;/list&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>This worked with my jetty plugin...however when I deploy the WAR file to the tomcat server I receive the following error:</p>
  
  <pre><code> org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'
  </code></pre>
  
  <p>In my external properties file I have the driver class and connect url defined. as so:</p>
  
  <pre><code>jndi.jpa.rms.datasource=jdbc/testDS
  rms.db.driver=com.mysql.jdbc.Driver
  rms.db.url=jdbc:mysql://testdatabaseurl:3306/test
  rms.db.user=sa
  rms.db.password=asfdas
  rms.db.checkconnsql=select 1
  rms.hibernate.generateddl=false
  rms.hibernate.showsql=true
  rms.hibernate.dbdialect=org.hibernate.dialect.MySQLDialect
  </code></pre>
  
  <p>Update:</p>
  
  <p>It seems that tomcat does pickup the external properties file:</p>
  
  <pre><code> 14:23:09.803 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Finished creating instance of bean 'modelPropertyPlaceholder'
   14:23:09.810 [main] INFO  o.s.w.c.s.ServletContextPropertyPlaceholderConfigurer - Loading properties file from class path resource [default.model.properties]
   14:23:09.810 [main] INFO  o.s.w.c.s.ServletContextPropertyPlaceholderConfigurer - Loading properties file from URL [file:/etc/app/app.properties]
   14:23:09.810 [main] INFO  o.s.w.c.s.ServletContextPropertyPlaceholderConfigurer - Loading properties file from ServletContext resource [/${config}]
   14:23:09.811 [main] WARN  o.s.w.c.s.ServletContextPropertyPlaceholderConfigurer - Could not load properties from ServletContext resource [/${config}]: Could not open ServletContext resource [/${config}]
  </code></pre>
  
  <p>I'm not sure why tomcat isn't picking up the connection url and driver.
  Is this a tomcat issue or am I missing something? Thanks</p>