启动项目的时候,tomcat报错,错误内容是
Error running 'Tomcat 8.5.84': Unable to open debugger port (127.0.0.1:12288): java.net.SocketException "Interrupted function call: accept failed"
首先先看一下有没有其它项目占用相同端口,如果发现没有,还是报错,可以用一下办法解决:
- 打开命里行,(cmd)
- 输入: netstat -ano | findstr "12288"
- 查询到这个端口的进程ID是多少
- 查询进程ID是哪个进程,再CMD输入tasklist | findstr "10136"
- 最后一步,杀死进程就可以了:taskkill /pid 10136 -f
结果到第二步什么也没有查出来,关机重启机器也不行。
以为是idea自己的bug,尝试重装了最新的版本,还是不行。
单独启动tomcat也是没有问题的。
明明端口没有被占用,怎么还是提示端口占用。排除了idea,java版本,tomcat等一切原因后,那问题肯定出在了操作系统本身。于是在网上搜了 "win10系统明明端口没有被占用,怎么还是提示端口占用",最终找到是什么原因,原因是系统保留了某些范围的端口 。直接原因可能与我昨天安装windows版docker时启用了win10的Hyper-V功能有关,Hyper-V保留了一些端口。
netsh interface ipv4 show excludedportrange protocol=tcp
在这里就可以看到在上面范围内的端口,都是不能用的。
解决方法一 (推荐):
tomcat启动时,配置的端口,都绕过上述的范围.
解决方法二 :
如果我们应用就要用特定的端口,就关闭系统的Hyper-V功能。
重启机器后,再次查看已经释放了一些端口
netsh interface ipv4 show excludedportrange protocol=tcp
- quot SocketException Interrupted debugger functionquot socketexception interrupted debugger 57757 quot socketexception端口 socket quot socketexception exception 调试器quot socketexception端口 importsnotusedasvalues quot functioning typescript quot addeventlistener function错误 quot typeerror computed function interrupted socketexception execution interrupted statement exceeded