记录springboot jar包冲突异常处理
异常说明:访问页面或者接口报错:java.lang.NoSuchMethodError: javax.servlet.http.HttpServletRequest.getHttpServletMapping()Lja
解决方案:
1.springboot版本为2.0,所用javaee-api为8.0
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>8.0</version>
<scope>provided</scope>
</dependency>
2.项目中有引入公司包resources.db,其引入javaee-api的版本是7.0,里面的类HttpServletRequest确实找不到getHttpServletMapping
3.通过源码可以看到8.0版本类HttpServletRequest包含getHttpServletMapping
抛出问题:javax.servlet-api也包含类HttpServletRequest包含getHttpServletMapping方法,引入这个包解决不了问题
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
<scope>provided</scope>
</dependency>