I am following the tutorial here: https://www.javainuse.com/spring/cloud-gateway-eureka.
I have 2 applications, accessible through localhost (localhost:8080/employee/messages, localhost:8082/consumer/messages). I also have a service discovery (Spring Cloud Eureka), and Spring Cloud Gateway for load balancing. I have registered all three of these with eureka.
Also, I running everything from my local machine, what is host.docker.internal here?
The application.properties file for gateway application looks like this:
server:
port: 9090
eureka:
client:
serviceUrl:
defaultZone: http://localhost:8083/eureka
spring:
application:
name: gateway-service
cloud:
gateway:
routes:
- id: employeeModule
uri: lb://FIRST-SERVICE
predicates:
- Path=/employee/**
- id: consumerModule
uri: lb://SECOND-SERVICE
predicates:
- Path=/consumer/**
But, whenever I try to access localhost:9090/employee/message, I get error code 500. The error logs in the gateway service look like this:
io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection timed out: no further information: host.docker.internal/10.7.250.57:8080
Caused by: java.net.ConnectException: Connection timed out: no further information
at java.base/sun.nio.ch.Net.pollConnect(Native Method) ~[na:na]
at java.base/sun.nio.ch.Net.pollConnectNow(Net.java:579) ~[na:na]
at java.base/sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:820) ~[na:na]
at io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:327) ~[netty-transport-4.1.38.Final.jar!/:4.1.38.Final]
at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:336) ~[netty-transport-4.1.38.Final.jar!/:4.1.38.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:685) ~[netty-transport-4.1.38.Final.jar!/:4.1.38.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:632) ~[netty-transport-4.1.38.Final.jar!/:4.1.38.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:549) ~[netty-transport-4.1.38.Final.jar!/:4.1.38.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:511) ~[netty-transport-4.1.38.Final.jar!/:4.1.38.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:918) ~[netty-common-4.1.38.Final.jar!/:4.1.38.Final]
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[netty-common-4.1.38.Final.jar!/:4.1.38.Final]
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[netty-common-4.1.38.Final.jar!/:4.1.38.Final]
at java.base/java.lang.Thread.run(Thread.java:830) ~[na:na]
Can someone tell me what is the error here.
Edit: I'm behind corporate proxy and not able to do something like: curl host.docker.internal:8080/employee/message