title: IOException parsing XML document from class path resource - HTTP Status 500 - Servlet.init()
body: <p>I am building a simple Spring MVC Maven built java WAR application. My Maven project cleans and builds successfully and deploys to the server with no errors using the eclipse tomcat plugin. However, when I try to run the application Servlet, I get the following exception : </p>
  
  <pre><code>    Aug 23, 2013 2:35:29 PM org.springframework.web.servlet.FrameworkServlet initServletBean
  INFO: FrameworkServlet 'FileWatcher': initialization started
  Aug 23, 2013 2:35:29 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
  INFO: Refreshing WebApplicationContext for namespace 'FileWatcher-servlet': startup date [Fri Aug 23 14:35:29 BST 2013]; root of context hierarchy
  Aug 23, 2013 2:35:29 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
  INFO: Loading XML bean definitions from class path resource [spring/file-watcher.xml]
  Aug 23, 2013 2:35:29 PM org.springframework.web.servlet.FrameworkServlet initServletBean
  SEVERE: Context initialization failed
  org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [spring/file-watcher.xml]; nested exception is java.io.FileNotFoundException: class path resource [spring/file-watcher.xml] cannot be opened because it does not exist
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:341)
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
      at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174)
      at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:209)
      at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180)
      at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125)
      at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94)
      at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:131)
      at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:522)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:436)
      at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:651)
      at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:599)
      at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:665)
      at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:518)
      at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:459)
      at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
      at javax.servlet.GenericServlet.init(GenericServlet.java:160)
      at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1280)
      at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1193)
      at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:865)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:136)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
      at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at java.lang.Thread.run(Thread.java:724)
  Caused by: java.io.FileNotFoundException: class path resource [spring/file-watcher.xml] cannot be opened because it does not exist
      at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:158)
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:328)
      ... 33 more
  </code></pre>
  
  <p>My project configuration is as follows : </p>
  
  <p><em>web.xml</em></p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      version="2.5"
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"&gt;
  
  
      &lt;display-name&gt;FileWatcher&lt;/display-name&gt;
  
      &lt;description&gt;File Watcher&lt;/description&gt;
  
  
      &lt;!-- To load multiple context files here just put a space between your files 
          listed, like here http://blog.codehangover.com/load-multiple-contexts-into-spring/ --&gt;
      &lt;servlet&gt;
          &lt;servlet-name&gt;FileWatcher&lt;/servlet-name&gt;
          &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
          &lt;init-param&gt;
              &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
              &lt;param-value&gt;classpath:spring/file-watcher.xml&lt;/param-value&gt;
          &lt;/init-param&gt;
          &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
      &lt;/servlet&gt;
  
  
  
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;FileWatcher&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/FileWatcher/*&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
      &lt;context-param&gt;
          &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
          &lt;param-value&gt;/WEB-INF/file-watcher.xml&lt;/param-value&gt;
      &lt;/context-param&gt;
  
      &lt;welcome-file-list&gt;
          &lt;welcome-file&gt;index.html&lt;/welcome-file&gt;
      &lt;/welcome-file-list&gt;
  
  &lt;/web-app&gt;
  </code></pre>
  
  <p><em>pom.xml</em></p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.springframework.org/schema/beans
     http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"
      default-autowire="byName"&gt;
  
      &lt;bean id="FileWatcher" class="com.test.FileWatcher" init-method="initialize" /&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>And my Java class looks as follows : </p>
  
  <pre><code> public class FileWatcher {
      ....
      }
  </code></pre>
  
  <p>I am new to using this system so I'm not sure where I have gone wrong, can anyone help me solve this error?</p>