2013-02-05 112 views
1

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

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> 
+0

你的班级是什么? – Renjith

+0

@ Renjith,在System.getProperty(“java.class.path”)我得到\ WEB-INF \ lib –

+0

建立后,你可以检查你是否有包含在类路径中的applicationContext.xml? – Renjith

回答

0

我刚刚签出的应用程序列表,我的IBM WebSphere Application Server上,并想出了另一个应用程序正在给这个异常。

相关问题