java.lang.ClassCastException: org.springframework.web.filter.CharacterEncodingFilter cannot be cast to javax.servlet.Filter
这个问题遇到好几回了,久了又忘记怎么解决的了,特此记录下;java
不少文章都说是<artifactId>servlet-api</artifactId>
这个包有冲突,处理以后仍是报错;web
使用如下代码能够直接找到冲突jar包spring
public static void main(String[] args) { URL url = Filter.class.getProtectionDomain().getCodeSource().getLocation(); System.out.println("path:"+url.getPath()); // 运行后打印:path:/D:/MavenRepository/org/apache/tomcat/embed/tomcat-embed-core/8.5.37/tomcat-embed-core-8.5.37.jar // 排除该jar包就解决问题了; }