java.lang.NoSuchMethodError: org.springframework.http.MediaType.getCharSet()Ljava/nio/charset/Charse
java.lang.NoSuchMethodError: org.springframework.http.MediaType.getCharSet()Ljava/nio/charset/Charset:问题解决
springMVC项目,在spring升级到5.2.5.RELEASE的版本之后,出现了如下问题:
在网上搜索到的方法,都不能很好的解决问题,包括:spring的版本问题,jar的加载顺序问题…
最终只能进入报错的源码中,找出报错的地方:
org.thymeleaf.spring4.util.SpringContentTypeUtils.computeViewContentType(SpringContentTypeUtils.java:59)
可以判定是thymeleaf-spring4:3.0.11.RELEASE,引起来的错误。
再到Maven市场,找出thymeleaf-spring4的最新版本,发现thymeleaf-spring4的最新版本就是3.0.11.RELEASE。
感觉要凉凉!!!
不想死心,要到thymeleaf的官网瞅瞅,可算是找到更高阶“thymeleaf-spring5”版本,赶紧替换过来。
重新编译,重启!
项目运行成功!收工!