1. 程式人生 > 其它 >IDEATomact Address localhost1099 is already in use

IDEATomact Address localhost1099 is already in use

Error running 'Tomcat 9.0.19': Address localhost:1099 is already in use

嘗試解決

第一步:查詢被佔用埠

netstat  -ano | findstr 1099

結果為空,尷尬,不是說in use嗎?

嘗試換了埠,無論怎麼換都是顯示xx is already in use

提示埠被佔用,但是實際上通過 netstat 並沒有看到有使用, 所以有些疑惑,經過一番搜尋,才發現是因為 Hyper-V 引起的 保留埠,這部分埠將會被系統保留,無法被其他應用程式所使用。

檢視保留埠。

netsh interface ipv4 show excludedportrange protocol=tcp

解決辦法有2個

1、換個埠。

2、解除保留。

方法一

解除保留需要禁用 Hyper-V ,並重啟,然後使用管理員執行 CMD 執行如下命令

netsh int ipv4 add excludedportrange protocol=tcp startport=1099 numberofports=4

方法二

按著這些次序:

  1. 確保將此文字複製到您的記事本,因為您將暫時失去網際網路連線。

  2. 以管理員身份開啟 CMD。

  3. 一一編寫這些命令以停止您的網路:

    net stop winnat

    net stop LanmanWorkstation

    net stop WlanSvc

  4. 從保留列表中排除埠 1099:

netsh int ipv4 add excludedportrange protocol=tcp startport=1099 numberofports=4
  1. 再次啟動您的網路:

net start winnat

net start LanmanWorkstation

net start WlanSvc

  1. 完畢。