问题描述
IDEA启动Spring项目报错:
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
java.lang.ClassNotFoundException: org.springframework.web.util.WebAppRootListener
java.lang.ClassNotFoundException: org.apache.logging.log4j.web.Log4jServletContextListener
java.lang.ClassNotFoundException: org.springframework.web.context.request.RequestContextListener
问题原因
spring-web.xml文件没有没有被IDEA识别到
解决方法
将spring主配置文件和spring-web配置文件添加到模块的spring配置中,重启TOMCAT即解决。
如果还无法解决问题,尝试如下操作: