解决方法:cmd 之后 懂得直接拿代码,不懂的继续看
netstat -aon|findstr "8080"
taskkill /pid 6828 /f
6868 代表占用8080的进程pid号
当然还有一种更直接的方法:重启电脑,直接解决
一、8080被占用问题描述
在做java项目的时候,总会碰到8080端口被占用问题,非常荣幸,我在同一天碰到了四五次,我随即立马做了份笔记,今天有人跑来问我我的8080被占用咋解决的,他百度一直看不懂,所以我决定做一篇我认为大家能看懂的教程,因为现在没有8080被占用问题,所以我打开idea,不断地点击debug(shift+F9)和run(shift+F10),终于让我把这个问题复现出来了,发生错误提示如下
Error starting ApplicationContext. To display the conditions report re-run your application with ‘debug’ enabled.
[00:25:59:587] [ERROR] - org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter.report(LoggingFailureAnalysisReporter.java:42) -
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.
[00:25:59:589] [INFO] - org.springframework.scheduling.concurrent.ExecutorConfigurationSupport.shutdown(ExecutorConfigurationSupport.java:208) - Shutting down ExecutorService ‘applicationTaskExecutor’
Disconnected from the target VM, address: ‘127.0.0.1:65034’, transport: ‘socket’
Process finished with exit code 1
二、解决办法
① 开始---->运行---->cmd(window+R组合键,输入cmd),确定,调出命令窗口
② 输入命令: netstat -aon|findstr “8080”,这个命令是查看占用8080端口进程,netstat -aon,命令是查看所有进程,我们这里只看占用8080的端口
③ 输入命令: taskkill /pid 12912 /f
注意这里我们是输入12912是对应的我这里的占用的pid
④.杀完了我们可以在调用第一个命令看一下是否杀完了,这样我们的8080 就可以继续用了。