title: ClassPathXmlApplicationContext - BeanDefinitionStoreException: IOException parsing XML document
body: <p>I have some unit tests that load an application context from an XML file:</p>
  
  <pre><code>@BeforeClass
  public static void setUp() throws Exception {
      ApplicationContext context = new ClassPathXmlApplicationContext("test-application-context.xml");
  
  }
  </code></pre>
  
  <p>This throws an exception: </p>
  
  <pre><code>org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [test-application-context.xml]; nested exception is java.io.FileNotFoundException: class path resource [test-application-context.xml] cannot be opened because it does not exist
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:344)
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304)
      at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180)
      at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:216)
      at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:187)
      at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:251)
      at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:127)
      at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:93)
      at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:129)
      at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:542)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:454)
      at org.springframework.context.support.ClassPathXmlApplicationContext.&lt;init&gt;(ClassPathXmlApplicationContext.java:139)
      at org.springframework.context.support.ClassPathXmlApplicationContext.&lt;init&gt;(ClassPathXmlApplicationContext.java:83)
  </code></pre>
  
  <p>My unit test class is in the folder: </p>
  
  <p>myproj/myproj-configuration-dal/src/test/java/com/mypatterns/api/data/impl/LogTest.java</p>
  
  <p>The resource file is in: </p>
  
  <p>myproj/myproj-configuration-dal/src/test/resources/test-application-context.xml</p>
  
  <p>I tried moving the xml file around and, also the entire resouce folder, to the following locations: the src folder, the folder where LogTest is, to the main folder (where the non-test sources are) and so on. </p>
  
  <p>Where exactly is this supposed to be? Where is ClassPathXmlApplicationContext looking for the resources?</p>
  
  <p>Thanks,
  Serban</p>