title: Spring - applicationContext.xml cannot be opened because it does not exist
body: <p>I have a Spring MVC application and a problem with JUnit tests combined with the file applicationContext.xml.</p>
  
  <p>In my JUnit test class I write:</p>
  
  <pre><code>final ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
  service = (TestServiceImpl) context.getBean("testServiceImpl");
  </code></pre>
  
  <p>The error I get is that aplicationContect.xml can not be found:</p>
  
  <blockquote>
    <p>org.springframework.beans.factory.BeanDefinitionStoreException: 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</p>
  </blockquote>
  
  <p>But it exists in the WEB-INF folder.</p>
  
  <p>So, what's wrong here? Why does the file not exist for the JUnit test?</p>