1
votes

I am reproducing this on windows 10, java 11 and java 8, but the following scenario is happening:

  1. try to start tomcat application server with intellij
  2. tomcat fails to start because of bind port failure
  3. port 1099 becomes unusable for any other application

The port is actually never open, by looking at netstat -qno, or netstat -ano with administrator rights, the entry never actually shows up, so no process is actually using it.

If I try restarting tomcat with a different port, the same problem repeats but now we have a different unusable port. If I restart my computer the port is free again, but as soon as I try to start tomcat, the problem repeats.

It seems to me like intellij/tomcat is messing up server/port/bind on windows and produces an unusable port.

1
It looks like some issue caused by a third-party antivirus/firewall. - CrazyCoder
Port 1099 is the RMI Registry port. Are you using RMI in your application? or your Tomcat configuration? or running the RMI Registry separately? - user207421
Ok, somehow I got everything to work by setting intellij to use port 5099. After exploring further, I just found out that ncat tool can listen to addresses 2091 and up, but not 2090 down. Ncat: bind to ::1:2090: An attempt was made to access a socket in a way forbidden by its access permissions. - w.devilus
netsh interface ipv4 show excludedportrange protocol=tcp would reveal the ports blocked/excluded, Hyper-V is known to incorrectly exclude huge port ranges. - CrazyCoder
I guess you just solved it. 1099 is indeed in the range shown. Any way to unblock it? As a side note, this issue started happening after a installed wsl2, so it does make sense. - w.devilus

1 Answers

1
votes

netsh interface ipv4 show excludedportrange protocol=tcp

would reveal the ports blocked/excluded, Hyper-V is known to incorrectly exclude huge port ranges and it's used with WSL2.

You could try changing the range of the dynamic ports with the following commands:

netsh int ipv4 set dynamicport tcp start=49152 num=16383
netsh int ipv4 set dynamicport udp start=49152 num=16383