在eclipse中運行spring web application時的異常: java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener


嚴重: Error configuring application listener of class org.springframework.web.context.ContextLoaderListener
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
.......

tomcat再發布web項目時,並沒有將maven的依賴包一起隨項目的編譯一並進行打包。

解決辦法

  1. 打開eclipse項目屬性 (點擊項目名,鼠標右鍵選"Properties").
  2. 選擇 "Deployment Assembly".
  3. 點擊"Add..."項
  4. 從菜單中選擇 "Java Build Path Entries", 然后"Next".
  5. 從Java Build Path Entries菜單中選擇"Maven Dependencies",然后"Finish".

此時可以看到"Maven Dependencies"已經被加入到Web Deployment Assembly定義中.


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM