Why is restarting tomcat9 resolving networking issues?

One possible source for the problem could be number of open file descriptors exceeding system limit.

When the system is in that state, run cat /proc/sys/fs/file-nr. The output looks like this:

46512   0   9223372036854775807

If the first number is close to third number, it means that all available file descriptors are in use.

To increase number of available file descriptors, you can run

sysctl -w fs.file-max=<number>
sysctl -p

Where <number> is higher than your existing maximum limit (third column in previous output).