# Web server failed to start. Port 9793 was already in use

Web server failed to start. Port 9793 was already in use.

文章目录

报错描述

  • Springboot项目启动控制台报错
bash 复制代码
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2023-10-12 09:55:44.462 ERROR 25112 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

Web server failed to start. Port 9793 was already in use.

Action:

Identify and stop the process that's listening on port 9793 or configure this application to listen on another port.

Disconnected from the target VM, address: '127.0.0.1:3187', transport: 'socket'

Process finished with exit code 1

报错原因

  • 端口被占用

解决方法

Spring Boot 修改默认端口号

  • 修改yml或者properties配置文件,加上参数:
yaml 复制代码
# properties 方式
server.port=8014

# yaml 方式
server:
  port: 8881
  • 注意启动成功后面,后端的端口号变为 8881

关闭占用某一端口号的进程

  • 使用cmd命令查看端口号占用情况,例如查看端口 8881,可以看出进程号为18644
bash 复制代码
netstat -ano | findstr 端口号
关闭该进程
  • 方法一:使用任务管理器关闭:菜单栏 -> 右键 - > 任务管理器 -> 详细信息,根据PID排序找到PID18644的进程,选择后点击结束任务
  • 方法二: 使用命令关闭
r 复制代码
taskkill -PID 18644 -F
相关推荐
xuxie134 小时前
SpringBoot文件下载(多文件以zip形式,单文件格式不变)
java·spring boot·后端
LiRuiJie6 小时前
深入剖析Spring Boot / Spring 应用中可自定义的扩展点
java·spring boot·spring
尚学教辅学习资料8 小时前
Ruoyi-vue-plus-5.x第五篇Spring框架核心技术:5.1 Spring Boot自动配置
vue.js·spring boot·spring
晚安里8 小时前
Spring 框架(IoC、AOP、Spring Boot) 的必会知识点汇总
java·spring boot·spring
上官浩仁9 小时前
springboot ioc 控制反转入门与实战
java·spring boot·spring
叫我阿柒啊9 小时前
从Java全栈到前端框架:一位程序员的实战之路
java·spring boot·微服务·消息队列·vue3·前端开发·后端开发
中国胖子风清扬10 小时前
Rust 序列化技术全解析:从基础到实战
开发语言·c++·spring boot·vscode·后端·中间件·rust
JosieBook14 小时前
【SpringBoot】21-Spring Boot中Web页面抽取公共页面的完整实践
前端·spring boot·python
刘一说14 小时前
Spring Boot+Nacos+MySQL微服务问题排查指南
spring boot·mysql·微服务
叫我阿柒啊18 小时前
从Java全栈到云原生:一场技术深度对话
java·spring boot·docker·微服务·typescript·消息队列·vue3