0

I have a simulator for one of the microservice that I am consuming . Both my microservice and the simulator are deployed on local host and I am able to invoke the simulator from curl but when it is invoked from Java Feign client I am getting connection Refused from the Feign client . 1)I have already checked that the simulator is up and running on the port

netstat -a
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 0.0.0.0:http-alt        0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:19090           0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:19091           0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:19092           0.0.0.0:*               LISTEN

2) I am able to invoke the simulator from Curl

curl -v -X GET -H "X-B3-ParentSpanId:9b9c585fae4b6909" -H "X-B3-Sampled:1" -H "X-B3-TraceId:897aa305e5cd4a0e9b9c585fae4b6909"     http://127.0.0.1:19092/restservices/oda/v1/flow/partner/BBY/reference/29920299209700018540
Note: Unnecessary use of -X or --request, GET is already inferred.
*   Trying 127.0.0.1...
* TCP_NODELAY set
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* Connected to 127.0.0.1 (127.0.0.1) port 19092 (#0)
> GET /restservices/oda/v1/flow/partner/BBY/reference/29920299209700018540 HTTP/1.1
> Host: 127.0.0.1:19092
> User-Agent: curl/7.59.0
> Accept: */*
> X-B3-ParentSpanId:9b9c585fae4b6909
> X-B3-Sampled:1
> X-B3-TraceId:897aa305e5cd4a0e9b9c585fae4b6909
>
{"cart":{"iccid":{"state":"xSEpJXbZHTieuwbEmkyw"},"imei":{"state":"qZqSNjyCRDcGtcNkkPuT"},"offer":{"state":"HepwvfrskMqCaIixZqdQ"},"phone":{"state":"IFjenviIgYSIxbTvxqgw"},"state":"TLNwJRHopqpUfIgpCOsL"},"customer":{"contactPhone":"LOfsPamSdUOAmBnGWHJU","customerId":"kwotSWtOKNCRcZTGwMWS","securityInfo":{"state":"cdQVsEhmmjdfacuptAdx"},"state":"uzjaUvZfUlwzlKBaKyri"},"id":"29920299209700018540","order":{" ":{"state":"ZorISJYWfCnCFDjwynQS"},"orderSubmit":{"state":"wxViwjAXJaKVbPlFjVCS"},"state":"mumvrXaOLqxYlobjWbDb"},"partnerReference":{"partnerId":"uklHdntzuiqVMDNkZTnm","referenceId":"UwXVOptxnakWMYdVaQrb"},"state":"elMbDlvjURDTlzvwddiO","validFor":{"endDateTime":"2018-03-08T23:27:56.213Z","startDateTime":"2017-12-08T23:27:56.213Z"}}< HTTP/1.1 200 OK
< Access-Control-Allow-Origin: *
< Content-Type: application/json
< Content-Length: 769
< Date: Tue, 25 Sep 2018 07:07:54 GMT
<
{ [769 bytes data]

But when it is invoked from my microservice via Feign client it is giving me connection Refused error

"label" : "feign.RetryableException: Connect to  [localhost/127.0.0.1] failed: Connection refused executing GET http://127.0.0.1:19092/restservices/oda/v1/flow/partner/BBY/reference/29920299209700018540"
satyesht
  • 499
  • 7
  • 19
  • Unless you're doing something special that you haven't mentioned (you're not running your java app in a docker container?), it just means that your simulator shut down between your curl attempt and your java attempt – Erwin Bolwidt Sep 25 '18 at 07:37
  • calling application(feign client) and the simulator both are running inside kubernetes pod ,and both are up and running ,the curl test was performed both after and before the failure of the Feign invocation of the simulator. – satyesht Sep 25 '18 at 07:45
  • Try it on a bare machine without kubernetes. If that works, it's a kubernetes problem (that's likely) – Erwin Bolwidt Sep 25 '18 at 07:56

1 Answers1

1

I solved this problem
turns out there are two same remote services
and one of them didn‘t start success
so i turn down the duplicate service
hope this solve you problem

Hanz
  • 244
  • 3
  • 8