tomcat启动报错找不到Spring ContextLoaderListener的解决办法

Problem:java web maven项目tomcat启动报错Spring ContextLoaderListener的解决办法

Reason:原因其实就是后台报错的异常错误信息:ContextLoaderListener这个class没有找到。出现错误的位置可能是:

1、查看配置文件web.xml中是否配置。

org.springframework.web.context.ContextLoaderListener在web.xml配置文件中已经配置 。

2、查看工程是否添加此jar包。

org.springframework.web.context.ContextLoaderListener的jar包为spring-web-4.1.0.RELEASE.jar,已添加。

3、项目部署的问题。

由于是Tomcat启动报错,所以查看Tomcat路径下的lib是否包括spring-web-4.1.0.RELEASE.jar,查看不存在此包。

Solution:

1. 右键单击工程项目 ->点击 properties
2. 选择 Deployment Assembly
3. 点击 Add -> Java Build Path Entries -> Next
4. 选择 Maven Dependencies -> Finish -> Apply -> OK
5. Clean project and server. 重启server

编者注:已经遇到不止一回这个问题了,记录留作以后查看。

参考http://www.yihaomen.com/article/java/471.htm ;https://www.cnblogs.com/mainstudio/p/6229659.html

猜你喜欢

转载自my.oschina.net/suncici1101/blog/1800902