天天看點

win10 IDEA啟動Tomcat報錯Address localhost:1099 is already in use解決辦法

解決方法:

1 通過cmd 查找占用端口對應的PID(程序号)

通過cmd查詢端口,指令:netstat -ano | findstr 1099 查找占用端口對應的PID(程序号)

# 列出所有端口占用情況
netstat -ano
# 精确找到被占用的端口對應的PID
netstat -ano|findstr "port"
# 檢視是哪個程序或程式占用了端口
tasklist|findstr "PID"
## 殺死程序
taskkill /f /t /im xx程序

## 查找那個程序占用了443端口
netstat -navo|find /i "listen"|find /i ":443"
## 8784 是VM占用了443端口

# 示例
taskkill /f /t /im System
# 示例
tasklist|findstr "4"
# 示例
netstat -ano|findstr "1099"
netstat -ano|findstr 1099
           
win10 IDEA啟動Tomcat報錯Address localhost:1099 is already in use解決辦法
win10 IDEA啟動Tomcat報錯Address localhost:1099 is already in use解決辦法

2 如果對應端口号下沒有占用的程序,檢視是否是Hyper-V保留占用了

使用指令 netsh interface ipv4 show excludedportrange protocol=tcp, 這個是查詢windows10下面的Hyper-V的端口保留的TCP範圍,結果顯示:端口2181被Hyper-V給保留了

win10 IDEA啟動Tomcat報錯Address localhost:1099 is already in use解決辦法

兩種解決方案:

1、修改端口:配置檔案将zookeeper的端口改為高位端口,比如21810 。

2、關閉Hyper-V。使用預設端口 操作如下:控制台–程式—程式和功能—啟動或關閉windows功能,去掉對号

win10 IDEA啟動Tomcat報錯Address localhost:1099 is already in use解決辦法

修改Hyper-V占用端口區間

netsh int ipv4 set dynamicportrange tcp start=19152 num=16384

win10 hyper-v 保留端口占用問題 - luckyangg - 部落格園

擴充

指令解析

指令 描述
netstat 顯示協定統計資訊和目前TCP/IP網絡連接配接
netstat 檢視目前哪些端口正在被使用
findstr 查找字元串,類似Linux下的grep指令
tasklist 顯示運作在本地或遠端計算機上的所有任務的應用程式和服務清單
taskkill 結束一個或多個任務或程序
taskkill /f 指定強制終止的過程(我覺得是程序)
taskkill /t 指定那個終止與父程序一起的所有子程序,常被認為是“樹終止”
taskkill /im imageName 指定将被終止的過程的圖像名稱

繼續閱讀