This is my very first question here. I am working on a Spring Boot application. Today I encountered a weird problem.
When I run my app and call POST http://localhost:8080/report for example, I should get pdf in response or some type of error code if something went wrong, but instead I get status 200 OK without a body.
When I tried to call a nonexistent service same thing happened. I put a breakpoint at the very first line of the implementation of this service but it never got there.
I tried to reinstall Java, and IntelliJ, updated windows, and disabled the firewall. This morning it worked just fine. I don't really understand what happened and I'm here to ask you what possibly could cause this.
It happened shortly after adding a certificate to Keystore, but I have done this so many times and this never happened before. Sorry for not being more specific, but I don't really know where to be specific because it suddenly stopped working.
Since I am a windows user, I ran netstat -ano -p tcp |find "8080", to check if the port is free. When the app is running I get
TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING 12832
when I stop the application, I do not get any output. Also tried changing the port to something else, but did not help.
Check what's running on port 8080 using
sudo lsof -i :8080.It's likely you already have another service there.
localhostcan point to both IPv4 and IPv6 interfaces, so multiple apps can technically bind on the same port onlocalhost.The solution would be to either change your Spring Boot app port or kill the conflicting app / change its port.
Java apps can be also forced to bind only to IPv4 interface using
-Djava.net.preferIPv4Stack=truein the VM Options.