# 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
相关推荐
A-Jie-Y30 分钟前
JAVA框架-SpringBoot环境搭建指南
java·spring boot
码界奇点1 小时前
基于Spring Boot的前后端分离商城系统设计与实现
java·spring boot·后端·java-ee·毕业设计·源代码管理
消失的旧时光-19432 小时前
Spring Boot 接口设计进阶:POST / PUT / DELETE 的本质区别与工程实践
spring boot·后端
MegaDataFlowers2 小时前
基于EasyCode插件的SpringBoot和Mybatis框架快速整合以及PostMan的使用
spring boot·mybatis·postman
devilnumber2 小时前
Spring Boot 2 vs Spring Boot 3:50 条核心区别 + 升级优势 + 避坑指南
java·spring boot·springboot升级
一 乐2 小时前
咖啡商城|基于springboot + vue咖啡商城系统(源码+数据库+文档)
java·数据库·vue.js·spring boot·论文·毕设·咖啡商城系统
码农周4 小时前
告别大体积PDF!基于PDFBox的Java压缩工具
java·spring boot
吕永强4 小时前
基于SpringBoot+Vue小区报修系统的设计与实现(源码+论文+部署)
spring boot·毕业设计·毕业论文·报修系统·小区报修
程序员老邢6 小时前
【产品底稿 05】商助慧 V1.1 里程碑:RAG 文章仿写模块全链路实现
java·spring boot·程序人生·ai·milvus
消失的旧时光-19436 小时前
Spring Boot 实战(三):Service 分层 + 统一返回 + 异常处理(工程级写法)
java·spring boot·接口·解耦