本地启动出错Unable to start ServletWebServerApplicationContext due to miss ServletWebServerFactory bean

Springboot项目打包成war上传到云服务器后,本地启动出错。
首先,我们去除为了上传云服务器所添加的步骤,详细见我的另一篇文章Springboot项目部署到阿里云服务器(war和jar)

然后,依然出错,在StackOverFlow上,有人说 在启动类上加上缺少@SpringBootApplication标注,或者是Spring bean缺少@EnableAutoConfiguration标注等问题。

还有说,到本地的Maven仓库下,找到。。.m2\repository\org\apache\tomcat删除该文件夹下的文件。

但是不是上述问题。

可以查看构建日志,会发现有maven冲突。
在这里插入图片描述
最终解决办法:
将pom中的spring-boot-starter-web的依赖删除,重新下载即可:
在这里插入图片描述

部分参考自:https://blog.csdn.net/taiyangdao/article/details/79984304

猜你喜欢

转载自blog.csdn.net/mulinsen77/article/details/87964434