-1

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.

abdo Salm
  • 1,678
  • 4
  • 12
  • 22
SNap97
  • 1
  • 2

1 Answers1

1

Check what's running on port 8080 using sudo lsof -i :8080.

It's likely you already have another service there.

localhost can point to both IPv4 and IPv6 interfaces, so multiple apps can technically bind on the same port on localhost.

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=true in the VM Options.

CrazyCoder
  • 389,263
  • 172
  • 990
  • 904
  • i just tried all u mentioned. Sadly, problem still persists. But thanks for answering. – SNap97 Sep 27 '22 at 19:14
  • Post `sudo lsof -i :8080` output in your question. – CrazyCoder Sep 27 '22 at 19:18
  • question updated – SNap97 Sep 27 '22 at 19:54
  • Do you have any third-party security or proxy software that can intercept and handle HTTP requests on this system? Can you share any sample project and provide the exact steps to trigger this problem so that others can try it on their systems and report if they get the same results? This will help to isolate the issue. – CrazyCoder Sep 27 '22 at 19:55
  • Sorry for the very late answer; I totally forgot about this question. A colleague of mine commented some parts of the code in shared module and pushed it to the master branch. – SNap97 Aug 03 '23 at 09:51