java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
1.背景:
maven项目迁移 、使用eclipse的maven update功能、更换(或者删除后添加)eclipse下面的tomcat服务器时,
2.启动时一般会出现以下问题:
①找不到监听器:
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener,一般网上的方法都是说jar没有找到,或者web.xml配置错误
② 不能找到action对应的类:
org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.oa.action.BooksAction] for bean with name 'booksAction' defined in ServletContext resource,一般网上的方法都是struts2文件配置错误
3.解决方法:
项目 —> 属性 -> Deployment Assembly -> Add -> Java Build Path Entries -> 选择Maven Dependencies -> Finish -> OK 把对应的Maven依赖包也发布到tomcat