spring工程在eclipse 運行報錯:找不到ContextLoaderListener

問題描述:java

用eclipse建立一個maven項目中以後,加入了spring有關的依賴,項目運行的時候報Error:configuring application listener of class org.springframework.web.context.ContextLoaderListenerweb

java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListenerspring

致使這個問題出現的緣由是在eclipse使用maven編譯打包的時候並無把依賴的jar打到web-inf下的lib下,因此纔會找不到org.springframework.web.context.ContextLoaderListener。app

解決方案:eclipse

1.右鍵點擊項目--選擇Properties,選擇Deployment Assembly,在右邊點擊Add按鈕,在彈出的窗口中選擇Java Build Path Entries。以下圖所示:maven

2.點擊Next,選擇Maven Dependenciesui

3.點擊Finish,而後能夠看到已經把Maven Dependencies添加到Web應用結構中了ip

四、而後從新部署項目OKci

相關文章
相關標籤/搜索