title: ContextLoaderListener problem while spring is loading up
body: <p>When my spring is loading up, it says <code>applicationContext.xml</code> is not found in the classpath by throwing <code>FileNotFoundException</code> as can be seen below. Please help me resolve this problem.</p>
  
  <p>my <code>web.xml</code> content is as follows,</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app xmlns="http://java.sun.com/xml/ns/j2ee"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
      version="2.4"&gt;
      &lt;context-param&gt;
          &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
          &lt;param-value&gt;/WEB-INF/Context.xml&lt;/param-value&gt;
      &lt;/context-param&gt;
  
      &lt;servlet&gt;
          &lt;servlet-name&gt;flex&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;/WEB-INF/web-spring-context.xml&lt;/param-value&gt;
          &lt;/init-param&gt;
          &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
      &lt;/servlet&gt;
      &lt;listener&gt;
          &lt;listener-class&gt;
              org.springframework.web.context.ContextLoaderListener
          &lt;/listener-class&gt;
      &lt;/listener&gt;
  
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;flex&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/messagebroker/*&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>The exception being thrown is as follows,</p>
  
  <blockquote>
    <p>SEVERE: Exception sending context
    initialized event to listener instance
    of class
    org.springframework.web.context.ContextLoaderListener
    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 Caused by:
    java.io.FileNotFoundException: class
    path resource [applicationContext.xml]
    cannot be opened because it does not
    exist     at
    org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:135)
      at
    org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:297)
      at
    org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:280)
      at
    org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:131)
      at
    org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:147)
      at
    org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:123)
      at
    org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:91)
      at
    org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:100)
      at
    org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:298)
      at
    org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:156)
      at
    org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246)
      at
    org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184)
      at
    org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
      at
    org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
      at
    org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
      at
    org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
      at
    org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
      at
    org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
      at
    org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:926)
      at
    org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:889)
      at
    org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
      at
    org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
      at
    org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
      at
    org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
      at
    org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
      at
    org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
      at
    org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
      at
    org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
      at
    org.apache.catalina.core.StandardService.start(StandardService.java:516)
      at
    org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
      at
    org.apache.catalina.startup.Catalina.start(Catalina.java:578)
      at
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native
    Method)   at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at
    java.lang.reflect.Method.invoke(Method.java:585)
      at
    org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
      at
    org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
    Nov 12, 2009 4:02:09 PM
    org.apache.catalina.core.ApplicationContext
    log</p>
  </blockquote>
  
  <p>When I don't want any files to be named <code>applicationContext.xml</code>, why it has to look for it? as it has been clearly stated in <code>web.xml</code>..</p>