# 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
相关推荐
Flittly5 小时前
【雕虫大技】Agent 动态 Skill 供应链安全加固(二):执行隔离沙箱实战
java·spring boot·spring
沐言人生6 小时前
HelloAgentR工程手记1/100天——项目工作流搭建
spring boot·agent·vibecoding
云烟成雨TD7 小时前
Micrometer 系列【33】Spring Boot Micrometer Metrics 自动配置模块解析
spring boot·云原生·micrometer
用户3126874877209 小时前
接口太慢?Spring Boot 缓存体系 @Cacheable 全链路拆解
spring boot
snow@li9 小时前
SpringBoot:AOP日志切面全景梳理/原理+流程+实战+避坑
java·开发语言·spring boot
snow@li11 小时前
SpringBoot:全套生命周期全景详解/应用级+Bean级
java·spring boot·rpc
凤山老林1 天前
Spring Boot @Async 线上实战:从默认配置到生产级线程池治理
java·spring boot·后端
凤山老林1 天前
Spring Boot 定时任务进阶:动态 Cron 与集群防重实战
java·spring boot·后端·定时任务·集群定时任务
凤山老林1 天前
Spring Boot 配置管理实战:多环境隔离、加密与 Nacos 热更新避坑指南
java·spring boot·后端
凤山老林1 天前
可观测性落地:Spring Boot 3.x + Actuator + Prometheus + Grafana 监控体系搭建
spring boot·grafana·prometheus