# 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
相关推荐
专业系统开发老赵1 小时前
[特殊字符]《多商户家政系统技术解析:SpringBoot+MyBatisPlus+UniApp高效实战指南》
spring boot·后端·uni-app
爱的叹息1 小时前
Spring 及 Spring Boot 条件化注解(15个)完整列表及示例
spring boot·python·spring
王达舒19942 小时前
Spring Boot中定时任务Cron表达式的终极指南
java·spring boot·后端
王强你强3 小时前
Spring Boot 启动参数终极解析:如何优雅地控制你的应用?
java·spring boot·后端
码递夫4 小时前
[NO-WX179]基于springboot+微信小程序的在线选课系统
java·spring boot·后端·微信小程序
Q186000000005 小时前
springboot 四层架构之间的关系整理笔记一
spring boot·后端·架构
猿来入此小猿7 小时前
基于SpringBoot+Vue3实现的宠物领养管理平台功能十六
java·spring boot·毕业设计·宠物·宠物领养·毕业源码·免费学习
程序员小刚8 小时前
基于SpringBoot + Vue 的考勤管理系统
vue.js·spring boot·后端
潘多编程9 小时前
Spring Boot分布式项目实战:装饰模式的正确打开方式
spring boot·分布式·后端