# 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
相关推荐
苹果酱056719 分钟前
细读 React | React Router 路由切换原理
java·vue.js·spring boot·mysql·课程设计
S-X-S1 小时前
Java面试题-Spring Boot
java·开发语言·spring boot
陈老师还在写代码2 小时前
SpringBoot的单机模式是否需要消息队列?分布式应用中消息队列如何和服务的发现与注册、配置中心、SpringMVC相配合
java·spring boot·后端
ppo_wu3 小时前
使用开源项目xxl-cache构建多级缓存
spring boot·redis·缓存
武昌库里写JAVA3 小时前
16.React学习笔记.React更新机制
java·开发语言·spring boot·学习·课程设计
添砖Java中3 小时前
深度解析策略模式:从理论到企业级实战应用
spring boot·spring·spring cloud·设计模式·maven·策略模式
陈老师还在写代码4 小时前
解释下SpringBoot中的服务、依赖项、微服务、分布式的概念和关系
spring boot·分布式·微服务
illus10n_CHOU4 小时前
【项目总结】易到家家政服务平台 —— 派单调度(7)
java·spring boot·后端·学习·设计模式
励碼5 小时前
SpringCloud - Gateway 网关
spring boot·spring·spring cloud·gateway
苹果酱05676 小时前
React Native之React整理(一)
java·spring boot·毕业设计·layui·课程设计