windows下用着用着时候突然zookeeper启动不了了。netstat查也没有找到端口占用,就是起不来。控制台报错
java.lang.reflect.UndeclaredThrowableException: null
at org.springframework.util.ReflectionUtils.rethrowRuntimeException(ReflectionUtils.java:147) ~[spring-core-5.2.15.RELEASE.jar:5.2.15.RELEASE]
at org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:818) ~[spring-boot-2.3.12.RELEASE.jar:2.3.12.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:322) ~[spring-boot-2.3.12.RELEASE.jar:2.3.12.RELEASE]
at org.ccframe.app.App.main(App.java:39) ~[main/:?]
Caused by: java.net.BindException: Address already in use: bind
at sun.nio.ch.Net.bind0(Native Method) ~[?:1.8.0_202]
打个断点看,是2181没启动成功,也就是zookeeper
搜了下是Hyper-V导致的,突然想起来自己刚在WSL里跑过应用。估计是这里的问题
于是执行下面命令:
netsh interface ipv4 show excludedportrange protocol=tcp
OMG,2181出现在排除端口之内了。
那么先重启来解决了。如果还不行,只能修改保留端口的定义范围了:
netsh int ipv4 set dynamicport tcp start=20000 num=16383