1. 程式人生 > >maven專案啟動報錯:java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

maven專案啟動報錯:java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

maven專案部署到tomcat時報錯:java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

檢查了maven的pom.xml,依賴引入正常。在工程Maven Dependencies檢視中也能看到spring-web-xxx.RELEASE.jar包

解決方案:

1.右鍵點選專案--選擇Properties

選擇Deployment Assembly,在右邊點選Add按鈕

2.在彈出的視窗中選擇Java Build Path Entries

3.點選Next,選擇Maven Dependencies

4.點選Finish,然後可以看到已經把Maven Dependencies新增到Web應用結構中了

操作完後,重新啟動專案即可!