# 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
相关推荐
杨运交6 小时前
[041][公共模块]分布式唯一ID生成器设计与实现:一款灵活可扩展的雪花算法框架
spring boot
Flittly1 天前
【AgentScope Java新手村系列】(14)人机交互
java·spring boot·spring
Flynt2 天前
从Spring Boot 4.0升到4.1,我在Maven和gRPC上栽了跟头
java·spring boot·后端
掉鱼的猫3 天前
Spring Boot → Solon 注解迁移实战指南:一张对照表说清楚
java·spring boot
人活一口气4 天前
Spring Boot与AIGC的完美结合:从零搭建智能内容生成平台
java·spring boot·aigc
java小白小7 天前
SpringBoot(01): 初识SpringBoot,从Spring的痛点说起
spring boot
用户3169353811837 天前
如何从零编写一个 Spring Boot Starter
spring boot
程序员晓琪8 天前
约定大于配置:基于 Java 包名自动生成 API 版本路由的最佳实践
java·spring boot·后端
Flittly8 天前
【AgentScope Java新手村系列】(11)中断与恢复
java·spring boot·spring
用户3521802454759 天前
🎆从 Prompt 到 Skill:让 Spring AI Agent 学会"装新技能"
人工智能·spring boot·ai编程