title: ClassPathResource.getFile() throws FileNotFoundException within WAR
body: <p>ClassPathResource.getFile() throws FileNotFoundException. Here is the code snippet :</p>
  
  <pre><code>    ClassPathResource emsInitResource = new ClassPathResource("ems-init.properties");
      Properties props = loadProps(emsInitResource.getFile());
      logger.info("found 'ems-init.properties' on classpath, processing...");
      emsHome = props.getProperty("ems.home");
      if (emsHome != null) {
          logger.info("'ems.home' property initialized from 'ems-init.properties' as '" + emsHome + "'");
      }
      FilenameFilter ff = new FilenameFilter() {
          public boolean accept(File dir, String name) {
              return name.startsWith("messages_") &amp;&amp; name.endsWith(".properties");
          }
      };
      File[] messagePropsFiles = emsInitResource.getFile().getParentFile().listFiles(ff);
      String locales = "en";
      for (File f : messagePropsFiles) {
          int endIndex = f.getName().indexOf('.');
          String localeCode = f.getName().substring(9, endIndex);
          locales += "," + localeCode;
      }
      logger.info("locales available configured are '" + locales + "'");
      props.setProperty("ems.locales", locales);
  </code></pre>
  
  <p>And the exception is :</p>
  
  <pre><code>9:38:04,902 INFO  [STDOUT] Caused by: java.io.FileNotFoundException: class path resource [ems-init.properties] cannot be resolved to absolute file path because it does not reside in the file system: vfs:/home/tanmoy/JBoss/jboss-as-distribution-6.0.0.Final/server/default/deploy/EMS.war/WEB-INF/classes/ems-init.properties
  19:38:04,902 INFO  [STDOUT]     at org.springframework.util.ResourceUtils.getFile(ResourceUtils.java:201)
  19:38:04,902 INFO  [STDOUT]     at org.springframework.core.io.ClassPathResource.getFile(ClassPathResource.java:175)
  19:38:04,902 INFO  [STDOUT]     at info.ems.config.EMSConfigurer.configureEMS(EMSConfigurer.java:45)
  19:38:04,902 INFO  [STDOUT]     at info.ems.config.EMSConfigurer.postProcessBeanFactory(EMSConfigurer.java:34)
  </code></pre>
  
  <p>But in the WAR the /WEB-INF/classes/ems-init.properties is present. How can I solve this problem? Thank you.</p>