跨境派

跨境派

跨境派,专注跨境行业新闻资讯、跨境电商知识分享!

当前位置:首页 > 卖家故事 > 程序启动报错org.springframework.context.ApplicationContextException: Unable to start web server

程序启动报错org.springframework.context.ApplicationContextException: Unable to start web server

时间:2024-03-26 09:36:07 来源:网络cs 作者:利杜鹃 栏目:卖家故事 阅读:

标签: 启动  程序 
阅读本书更多章节>>>>

目录

一、场景二、报错信息三、原因四、解决


一、场景

1、该项目在Linux和本机电脑上启动都正常

2、在另一台电脑上启动就报错

3、代码都是同一份,没有差别


二、报错信息

org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:157)at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142)at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775)at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)at org.springframework.boot.SpringApplication.run(SpringApplication.java:316)at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260)at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248)at com.xxx.RobotManagerSvr.main(RobotManagerSvr.java:32)Caused by: org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.getWebServerFactory(ServletWebServerApplicationContext.java:206)at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:180)at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:154)... 8 common frames omitted

三、原因

导入spring-boot-starter-tomcat依赖时定义的scope导致

原依赖导入配置

<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-tomcat</artifactId>    <!--是provided导致--><scope>provided</scope></dependency>

四、解决

调整后依赖导入配置

<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-tomcat</artifactId>    <!--测试时先注释该配置--><!--<scope>provided</scope>--></dependency>

注:本机就算是provided也能正常启动,另一台电脑上就不行,应该是运行环境上的差异

阅读本书更多章节>>>>

本文链接:https://www.kjpai.cn/gushi/2024-03-26/148752.html,文章来源:网络cs,作者:利杜鹃,版权归作者所有,如需转载请注明来源和作者,否则将追究法律责任!

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。

文章评论