servlet-api2.0与javax servlet-api版本冲突——Action: Correct the classpath of your application so that it

今天在学SpringCloud时出现一个jar包冲突,记录一下

报错信息如下:Correct the classpath of your application so that it contain a single ,compatible version of javax.servlet.ServletContext
在这里插入图片描述
那么问题来了,servlet-api 2.0 和 javax servlet-api 3.x 本质上是同一个包,但是却是不同的版本,所以当项目中调用servlet-api 2.0版本时就会自动生成,而我的版本比较高对应的是javax servlet-api 3.x版本的。

所以当两个同时存在时,就发生jar包冲突了,结果就是删掉低版本的servlet-api如下:
在这里插入图片描述
删掉以后再运行就可以了
在这里插入图片描述