1.表现为:加上下面这段就挂掉
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
严重: 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 ServletContext resource [/applicationContex.xml]; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/applicationContex.xml]
严重: Error listenerStart
2016-4-13 21:47:56 org.apache.catalina.core.StandardContext start
严重: Context [/whatever] startup failed due to previous errors
2016-4-13 21:47:56 org.apache.catalina.core.ApplicationContext log
信息: Closing Spring root WebApplicationContext
网页显示404
错误原因:找不到spring的配置文件,导致启动失败。具体是路径问题。<!-- 配置spring配置文件的名称和地址 -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>applicationContex.xml(或者classpath:applicationContex.xml)</param-value>
</context-param>
这样都找不到。
而要改成:
<!-- 配置spring配置文件的名称和地址 -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/classes/applicationContex.xml</param-value>
</context-param>
这样才能找得到。
不需要自己手工建立对应文件夹。
当然,我还没搞清楚为什么这样才行,毕竟视频里和别人的代码里想上边那么写没问题。