首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 服务器 > Apache >

关于web.xml路径出错的有关问题

2013-08-01 
关于web.xml路径出错的问题ssh框架里面,我的applicationContext.xml放在src下面。而我的web.xml文件在WebRo

关于web.xml路径出错的问题
ssh框架里面,我的applicationContext.xml放在src下面。而我的web.xml文件在WebRoot/WEB-INF/lib/web.xml(即默认的目录下)
我在web.xml配置applicationContext.xml是这样写的
<context-param>
        <param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
启动Tomcat时报错,报错的部分内容如下
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


麻烦各位大神指点一下! web.xml Path
[解决办法]
web.xml应该在WebRoot/WEB-INF/下,而不是在lib下面
web.xml里面写


<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/classes/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

[解决办法]
web.xml应该在WebRoot/WEB-INF/下,而不是在lib下面
web.xml里面写

<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:applicationContext.xml</param-value>
</context-param>
<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

热点排行