加载applicationContext时出现FileNotFound异常

时间:2013-02-05 07:12:37

标签: java spring applicationcontext

我有一个使用Spring Framework的应用程序。突然间,我开始在服务器启动时遇到异常。例外情况如下:

ContextLoader E org.springframework.web.context.ContextLoader initWebApplicationContext
   Context initialization failed
   org.springframework.beans.factory.BeanDefinitionStoreException:
   IOException parsing XML document from ServletContext resource
   [/WEB-INF/applicationContext.xml]; nested exception is
   java.io.FileNotFoundException: Could not open ServletContext resource
   [/WEB-INF/applicationContext.xml]

但我肯定在src / main / webapp / WEB-INF /文件夹中有这个文件。我正在使用IBM WebSphere,在服务器启动时,我得到了这个异常。如果我只是重新部署我的应用程序(我在IntelliJ IDEA工作) - 没有例外。

值得补充的是,我开始突然得到这个例外。我没有更改配置文件。

如何解决此问题?

这是我的web.xml文件:

<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>

<servlet>
    <servlet-name>mvc-dispatcher</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/applicationContext.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
    <servlet-name>mvc-dispatcher</servlet-name>
    <url-pattern>/</url-pattern>
</servlet-mapping>

<filter>
    <filter-name>springSecurityFilterChain</filter-name>
    <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>

<filter-mapping>
    <filter-name>springSecurityFilterChain</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

<listener>
    <listener-class>
        org.springframework.web.context.ContextLoaderListener
    </listener-class>
</listener>

<session-config>
    <session-timeout>
        30
    </session-timeout>
</session-config>

1 个答案:

答案 0 :(得分:0)

我刚刚检查了IBM WebSphere应用服务器上的应用程序列表,并发现另一个应用程序正在提供此异常。