与consul服务的FeignClient调用在docker容器中抛出连接被拒绝

时间:2016-05-27 15:52:23

标签: docker docker-compose consul spring-cloud-feign

我有用于领事和我的服务的docker容器。我假装客户端界面试图达到在领事注册的服务。它适用于本地测试(使用localhost);但是在容器环境中同样不起作用。 例外:

web_1 | 2016-05-27 15:40:01.131 INFO 1 --- [gement-client-1] c.n.l.DynamicServerListLoadBalancer : DynamicServerListLoadBalancer for client my-client initialized: DynamicServerListLoadBalancer:{NFLoadBalancer:name=my-client,current list of Servers=[consul:9090],Load balancer stats=Zone stats: {unknown=[Zone:unknown; Instance count:1; Active connections count: 0; Circuit breaker tripped count: 0; Active connections per server: 0.0;] web_1 | },Server stats: [[Server:consul:9090; Zone:UNKNOWN; Total Requests:0; Successive connection failure:0; Total blackout seconds:0; Last connection made:Thu Jan 01 00:00:00 UTC 1970; First connection made: Thu Jan 01 00:00:00 UTC 1970; Active Connections:0; total failure count in last (1000) msecs:0; average resp time:0.0; 90 percentile resp time:0.0; 95 percentile resp time:0.0; min resp time:0.0; max resp time:0.0; stddev resp time:0.0] web_1 | ]}ServerList:ConsulServerList{serviceId='my-client', tag=null} web_1 | 2016-05-27 15:40:02.088 INFO 1 --- [pool-5-thread-1] c.netflix.config.ChainedDynamicProperty : Flipping property: my-client.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647 web_1 | 2016-05-27 15:40:02.525 ERROR 1 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is com.netflix.hystrix.exception.HystrixRuntimeException: getUser failed and no fallback available.] with root cause web_1 | web_1 | java.net.ConnectException: Connection refused web_1 | at java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:1.8.0_72-internal] web_1 | at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[na:1.8.0_72-internal] web_1 | at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[na:1.8.0_72-internal] web_1 | at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[na:1.8.0_72-internal] web_1 | at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:1.8.0_72-internal] web_1 | at java.net.Socket.connect(Socket.java:589) ~[na:1.8.0_72-internal] web_1 | at sun.net.NetworkClient.doConnect(NetworkClient.java:175) ~[na:1.8.0_72-internal] web_1 | at sun.net.www.http.HttpClient.openServer(HttpClient.java:432) ~[na:1.8.0_72-internal] web_1 | at sun.net.www.http.HttpClient.openServer(HttpClient.java:527) ~[na:1.8.0_72-internal] web_1 | at sun.net.www.http.HttpClient.<init>(HttpClient.java:211) ~[na:1.8.0_72-internal] web_1 | at sun.net.www.http.HttpClient.New(HttpClient.java:308) ~[na:1.8.0_72-internal] web_1 | at sun.net.www.http.HttpClient.New(HttpClient.java:326) ~[na:1.8.0_72-internal] web_1 | at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1169) ~[na:1.8.0_72-internal] web_1 | at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1105) ~[na:1.8.0_72-internal] web_1 | at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:999) ~[na:1.8.0_72-internal] web_1 | at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:933) ~[na:1.8.0_72-internal] web_1 | at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1513) ~[na:1.8.0_72-internal] web_1 | at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441) ~[na:1.8.0_72-internal] web_1 | at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480) ~[na:1.8.0_72-internal] web_1 | at feign.Client$Default.convertResponse(Client.java:152) ~[feign-core-8.16.2.jar!/:8.16.2] web_1 | at feign.Client$Default.execute(Client.java:74) ~[feign-core-8.16.2.jar!/:8.16.2] web_1 | at org.springframework.cloud.netflix.feign.ribbon.FeignLoadBalancer.execute(FeignLoadBalancer.java:77) ~[spring-cloud-netflix-core-1.1.0.RELEASE.jar!/:1.1.0.RELEASE]

0 个答案:

没有答案