How would you investigate the following issue?
On a specific server; any HTTP-Requests sent to a Java Server running on localhost fails with "Connection refused". (See the Java code here)
In the Java Server-Application no sign of any problems is visible. The port seems to be listening, but when I try to send a HTTP request with cURL to the Java HTTP-Server application; cURL logs "Connection refused." (I use curl in mingw on the Windows 10 system)
The started Java Server application:
C:\test>java LogTCP_S 8000
Listening on port:8000, type Crtl-C to finish
The curl command [NOK]:
$ curl localhost:8000
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0
curl: (7) Failed to connect to localhost port 8000: Connection refused
The same Java code works as expected on my Workstation.
I have also tried a different Java Application. I got the same result using the code from the following answer from StackOverflow: simple HTTP server in Java using only Java SE API
The issue happens on a Windows 10 System. There are several anomaly-detection tools and firewall applications and we are having a hard time to identify the source of the problem.
Hint: netstat -a won't list the port 8000. But it should be actually shown as LISTENING.
Hint: When starting a server in PowerShell (as described here), the communication works as expected. The port of the PowerShell Server will be listed in the netstat -a output and the requests return HTTP 200 and the expected content.
Could you please give me a hint, how to debug, investigate or resolve this issue? What tools could be helpful, when investigating such issues?
Any help would be greatly appreciated.
Thank you very much.
Java Version:
C:\>java -version
java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)
Output of the PowerShell Server:
Windows PowerShell
Copyright (C) 2016 Microsoft Corporation. All rights reserved.
PS C:\Temp\_test\PowerShell> .\server.ps1
[PowerShell] Listening at http://localhost:8000/... (port 8000)
> http://localhost:8000/ola
< 200
curl output, when the PowerShell is running [OK]:
$ curl localhost:8000/ola
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 38 100 38 0 0 612 0 --:--:-- --:--:-- --:--:-- 612
<html><body>Hello world!</body></html>