运行SpringBoot项目,8080端口被占用的解决办法 您所在的位置:网站首页 端口号10000被占用怎么解决 运行SpringBoot项目,8080端口被占用的解决办法

运行SpringBoot项目,8080端口被占用的解决办法

2023-12-28 13:34| 来源: 网络整理| 查看: 265

文章目录 1.问题展示2.出错原因3.解决办法

1.问题展示 APPLICATION FAILED TO START Description: The Tomcat connector configured to listen on port 8080 failed to start. The port may already be in use or the connector may be misconfigured. Action: Verify the connector’s configuration, identify and stop any process that’s listening on port 8080, or configure this application to listen on another port. 2.出错原因 其他Spring Boot项目占用8080端口;(我这次出错就是此原因)电脑中其他进程占用8080端口;多次运行的项目,重复生成占用了端口。 3.解决办法

Spring Boot项目会采用默认的8080端口号 根据报错描述有两种解决办法。 法一:更改项目运行的端口号 通过改项目的配置文件(springboot的配置文件有两种,根据个人喜好修改配置) 在配置文件(application.propertites)添加server.port=8001(此数字非8080即可,随便写) 在这里插入图片描述 在配置文件(application.yml)添server.port: 8081(此数字非8080即可,随便写) 注意:后要有空格 在这里插入图片描述

法二:使用cmd结束占用8080端口的进程

输入win+R快捷键,输入cmd,打开命令行窗口输入以下命令 netstat -ano|findstr 8080,显示占用8080的进程,可见为7024 在这里插入图片描述 taskkill /f /t /im 7024,将8080端口的进程全部关闭

在这里插入图片描述 解释:相关命令如下: /t: 杀掉指定进程和由它启动的子进程。 /f: 强制终止指定进程

再次启动类显示正常

在这里插入图片描述



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有