title: Spring: Can not find applicationContext even though it's present in war file
body: <p>My test looks like  </p>
  
  <pre><code>public class ITCache extends AbstractIntegrationTest {
      @Test
      public void readCache() {
          ApplicationContext applicationContext = new ClassPathXmlApplicationContext("applicationContext.xml");
          assertNotNull(applicationContext);
          final SimpleCacheManager simpleCacheManager = (SimpleCacheManager) applicationContext.getBean("cacheManager");
          System.out.println("cacheName:" + simpleCacheManager.getCacheNames().toString());
          System.out.println(simpleCacheManager.getCache("genders").toString());
      }
  }
  </code></pre>
  
  <p>I deploy my project using <code>maven-cargo</code> plugin and can see the contents and find <code>applicationContext.xml</code> as well  </p>
  
  <pre><code>➜  comma git:(S120297) ✗ jar -tvf integration/target/cargo/configurations/tomcat7x/webapps/common.war | grep app
    2342 Wed Jul 16 20:28:32 PDT 2014 WEB-INF/classes/applicationContext.xml
  ➜  comma git:(S120297) ✗  
  </code></pre>
  
  <p>But when I run test, I see failures as  </p>
  
  <pre><code>Tests in error: 
    readCache(com.org.comma.integration.ITCache): IOException parsing XML document from class path resource [applicationContext.xml]; nested exception is java.io.FileNotFoundException: class path resource [applicationContext.xml] cannot be opened because it does not exist  
  </code></pre>
  
  <p>I also tried annotating my test as  </p>
  
  <pre><code>@RunWith(SpringJUnit4ClassRunner.class)
  @ContextConfiguration (locations = "classpath*:/applicationContext*.xml")
  public class ITCache extends AbstractIntegrationTest {  
  </code></pre>
  
  <p>but still same issue</p>
  
  <p>What is going wrong here?</p>
  
  <p><strong>UPDATE</strong><br>
  My <code>web.xml</code> has entry as following  </p>
  
  <pre><code>    &lt;context-param&gt;
          &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
          &lt;param-value&gt;classpath:applicationContext.xml&lt;/param-value&gt;
      &lt;/context-param&gt;
      &lt;listener&gt;
          &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
      &lt;/listener&gt;
  </code></pre>