1. 程式人生 > >eclipse下新增專案的Maven依賴包

eclipse下新增專案的Maven依賴包

我們在使用eclipse建立maven專案後,pom.xml檔案中新增的依賴包在執行tomcat後會報錯找不到類。如下:

java.lang.ClassNotFoundException: org.springframework.web.filter.CharacterEncodingFilter
嚴重: Exception starting filter Spring character encoding filter
java.lang.ClassNotFoundException: org.springframework.web.filter.CharacterEncodingFilter
 at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358)
 at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
 at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:249)
 at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)
 at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
 at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3693)
 at org.apache.catalina.core.StandardContext.start(StandardContext.java:4340)
 at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)

解決辦法:

1、在所在的專案右鍵properties ,按圖操作新增專案Maven依賴包。

 

2、應用後 ,導航欄選擇project->clean 

3、啟動tomcat