springMVC的配置文件的配置。

问题:IOException parsing XML document from ServletContext resource [/WEB-INF/application.xml

我把web.xml中的全局的

<context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:spring-mvc.xml</param-value>
    </context-param>
注释以后报出以上的错误了。
注释去掉以后不会报错了。我很纳闷的是springMVC的servlet上配置了contextConfigLocation,但是在web.xml的全局还要再配置一次。

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:web="http://java.sun.com/xml/ns/javaee" xmlns="http://java.sun.com/xml/ns/javaee"
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
	id="WebApp_ID" version="2.5">
	<display-name>sym_cps</display-name>
	<!-- 程序Session配置 -->
	<session-config>
		<!-- Session过期时间(单位:分) -->
		<session-timeout>30</session-timeout>
	</session-config>
	<context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:spring-mvc.xml</param-value>
    </context-param>
	<filter>
		<filter-name>SpringEncodingFilter</filter-name>
		<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
		<init-param>
			<param-name>encoding</param-name>
			<param-value>UTF-8</param-value>
		</init-param>
		<init-param>
			<param-name>forceEncoding</param-name>
			<param-value>true</param-value>
		</init-param>
	</filter>
	<filter-mapping>
		<filter-name>SpringEncodingFilter</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>
	
	<servlet>
		<servlet-name>spring-mvc</servlet-name>
		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
		<init-param>
			<param-name>contextConfigLocation</param-name>
			<param-value>classpath:spring-mvc.xml</param-value>
		</init-param>
		<load-on-startup>1</load-on-startup>
	</servlet>
	<servlet-mapping>
		<servlet-name>spring-mvc</servlet-name>
		<url-pattern>/cps/*</url-pattern>
	</servlet-mapping>
	<listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
 	</listener>
	<!-- 用于启动socket服务器,对zhbcms提供支持 -->
	<!-- <listener>
		<listener-class>com.zhht.cps.listener.FileServerListener</listener-class>
	</listener> -->
	<listener>
		<listener-class>com.zhht.cps.executor.tcppush.CpsServerListener</listener-class>
	</listener>
	<welcome-file-list>
		<welcome-file>index.html</welcome-file>
		<welcome-file>index.jsp</welcome-file>
	</welcome-file-list>
</web-app>

 

猜你喜欢

转载自nicegege.iteye.com/blog/2286284