我们在使用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

 

 

 

GitHub 加速计划 / ma / maven
36
0
下载
Maven: Apache Maven是一个开源的项目管理和构建工具,主要用于Java项目。适合需要自动化项目构建和依赖管理的开发者。特点包括约定优于配置、易于使用和社区驱动。
最近提交(Master分支:17 天前 )
2865dac1 - https://github.com/checkstyle/checkstyle/pull/17782 Co-authored-by: Vincent Potucek <vpotucek@me.com> 58 分钟前
7872c6d8 Changes: * update Mimir to latest 0.8.1 version * update infusers as well * cache changes (see below) Cache strategy changes: * initial build: it is snowballing one cache when build is not about PR * full (rebuild itself + site with itself) and its build: it is snowballing cache differentiated by OS/JDK when build is not about PR Current problems: on unchanged POM (ie. new IT added), the dependencies ITs pull from Central will be cached by Mimir, but due "cache hit" the new cache will not get stored. Hence, Mimir caching was basically lost. Also, there was a mixup of caches from PRs and main branches. Finally, matrix jobs were competing for cache store. 2 天前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐