ssm项目,web容器无法初始化项目
在web.xml中配置加载spring时,发现项目无法运行;而去掉spring的配置时,项目可以被初始化。
此时应考虑到spring的配置文件中存在错误,以至于web容器无法对项目成功初始化,在web.xml中配置log4j,
根据打印的信息对spring的配置进行修改。
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>classpath:log4j.properties</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
<!-- 加载spring容器 -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring/applicationContext-*.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>ssm-test-3</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring/springmvc.xml</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>ssm-test-3</servlet-name>
<url-pattern>*.action</url-pattern>
</servlet-mapping>