I'm having this error while using webclient in localhost, can you help me guys??
ERROR org.springframework.boot.autoconfigure.web.reactive.error.AbstractErrorWebExceptionHandler - [0e1ef5cd-1] 500 Server Error for HTTP G
ET "/product/spec/template/posts"
product | io.netty.channel.AbstractChannel$AnnotatedConnectException: finishConnect(..) failed: Connection refused: localhost/127.0.0.1:8090
product | Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException:
product | Error has been observed at the following site(s):
product | |_ checkpoint ⇢ Request to GET http://localhost:8090/retailer/retailer/posts/12 [DefaultWebClient]
product | |_ checkpoint ⇢ Handler com.zucco.tech.hm.service.product.controller.ProductSpecTemplateController#posts() [DispatcherHandler]
product | |_ checkpoint ⇢ org.springframework.boot.actuate.metrics.web.reactive.server.MetricsWebFilter [DefaultWebFilterChain]
product | |_ checkpoint ⇢ HTTP GET "/product/spec/template/posts" [ExceptionHandlingWebHandler]
product | Stack trace:
product | Caused by: java.net.ConnectException: finishConnect(..) failed: Connection refused
product | at io.netty.channel.unix.Errors.throwConnectException(Errors.java:124) ~[netty-transport-native-unix-common-4.1.51.Final.jar!/:4.1.51.Final]
No, we can not call direct by localhost, the term here is "container call container", so, we should call together by container name.
order-service: build: docker/order-service container_name: order-service ports: - 8082:8080
private String hostname = "http://order-service:8080/order-service/welcome";
You can see, when we call order service by browser (real client), we call throught extend port (8082), but in case container call container, we should call by it s container
s name and it`s port (8080).
Connection refused means that there was no server listening on the address:port. You can check with netstat -tulpen
what ports are open on which address.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.