Java - SpringBoot + Feign + Eureka (Feign not resolving URL from Eureka)
Asked Answered
S

0

7

I have an Eureka server already running and I have a Microservice registered there (account-server -> Service B). The issue is when trying to use Feign from Service A. Let's say I have a class in Service A.

@FeignClient("account-server")
public interface AccountFooProxy {
    @RequestMapping(
            value = {"/deviceToken/{deviceToken}"},
            method = {RequestMethod.GET}
    )
    String getAccountByDeviceToken(@PathVariable("deviceToken") String var1);

}

I already know "account-server" is registered in Eureka. The SpringBoot in Service A is:

@SpringBootApplication
@EnableFeignClients
@EnableDiscoveryClient
public class AuthServerApplication {
    public static void main(String[] args) {
        SpringApplication.run(AuthServerApplication.class, args);
    }
}

Then a RestController in same, Service A, where I have created this dummy class to @Autowired a FeignClient to invoke Service B

@RestController
@RequestMapping("/foo")
class FooTest {

    @Autowired
    private AccountFooProxy accountProxy;

    private static final String DEVICE_TOKEN = "xxx";

    @RequestMapping(path = "/foo", method = RequestMethod.GET)
    public ResponseEntity<Object> addAuth()  {
        return ResponseEntity.ok(accountProxy.getAccountByDeviceToken(DEVICE_TOKEN));
    }

}

Eureka configuration:

spring.application.name=discovery-server
server.port=8002
spring.resources.add-mappings=true
management.endpoints.web.exposure.include=*

spring.security.user.name=discovery
spring.security.user.password=discovery

# CONFIGURATION SERVER
spring.cloud.config.uri=http://localhost:8000
spring.cloud.config.discovery.enabled=true

# EUREKA CONFIGURATION
eureka.client.serviceUrl.defaultZone=http://discovery:discovery@localhost:8002/eureka
eureka.client.register-with-eureka=true
eureka.client.fetch-registry=true

The profile resolved these data for Service B:

server.port=0
server.name=ACCOUNT
server.servlet.context-path=/

# CLIENT KEY AES-256 SALT
secure.clientKey.salt=ABCDEF

api.gateway.url=http://localhost:8081

# EUREKA CONFIGURATION
eureka.client.serviceUrl.defaultZone=http://discovery:discovery@localhost:8002/eureka
eureka.client.register-with-eureka=true
eureka.client.fetch-registry=true
eureka.client.healthcheck.enabled=true

authy.apiKey=123123
twilio.verificationCodeLength=6

hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds=4000

The profile resolved these data for Service A:

server.port=8083
server.servlet.context-path=/

jwt.token.issuer=com.passid

hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds=10000

push.deferredSendDelaySeconds=4

api.gateway.url=http://localhost:8081

# EUREKA CONFIGURATION
eureka.client.serviceUrl.defaultZone=http://discovery:discovery@localhost:8002/eureka

eureka.client.register-with-eureka=true
eureka.client.fetch-registry=true
eureka.client.healthcheck.enabled=true
eureka.instance.prefer-ip-address: true

When I do the request: http://localhost:8083/foo/foo which is running in Service A the feign client is trying to do the request in this URL: http://account-server/deviceToken/xx which is incorrect.

I am getting: Caused by: feign.RetryableException: connect timed out executing GET http://account-server/deviceToken/xx

What I have to do in order to resolve the correct URL from Eureka?

If it helps this is my guild.gradle file

plugins {
    id 'org.springframework.boot' version '2.1.3.RELEASE'
    id 'java'
}

apply plugin: 'io.spring.dependency-management'
apply plugin: 'java'

group = 'com.foo'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'

bootJar {
    launchScript()
}

configurations {
    compile.exclude module: "spring-boot-starter-tomcat"
}

ext {
    set('springCloudVersion', 'Greenwich.RELEASE')
}

repositories {
    maven { url 'https://repo.spring.io/snapshot' }
    maven { url 'https://repo.spring.io/releases' }
    gradlePluginPortal()
}

dependencies {
    implementation 'org.springframework.cloud:spring-cloud-starter-config'
    implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client'
    implementation 'org.springframework.cloud:spring-cloud-starter-openfeign'
    implementation 'org.springframework.cloud:spring-cloud-starter-netflix-ribbon'


    implementation 'org.springframework.boot:spring-boot-starter-actuator'
    implementation 'org.springframework.boot:spring-boot-starter-undertow'
    implementation 'org.springframework.boot:spring-boot-starter-data-rest'

    implementation 'com.auth0:java-jwt:3.7.0'

    implementation('com.squareup.wire:wire-runtime:2.2.0')

    implementation 'io.springfox:springfox-swagger2:2.9.2'
    implementation 'io.springfox:springfox-swagger-ui:2.9.2'

    testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

dependencyManagement {
    imports {
        mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
    }
}

An Image of Eureka running: enter image description here

Logs of the error:

08:27:23.021 [main] INFO  c.n.d.s.r.aws.ConfigClusterResolver - Resolving eureka endpoints via configuration
08:27:23.247 [main] INFO  c.netflix.discovery.DiscoveryClient - Disable delta property : false
08:27:23.247 [main] INFO  c.netflix.discovery.DiscoveryClient - Single vip registry refresh property : null
08:27:23.248 [main] INFO  c.netflix.discovery.DiscoveryClient - Force full registry fetch : false
08:27:23.249 [main] INFO  c.netflix.discovery.DiscoveryClient - Application is null : false
08:27:23.250 [main] INFO  c.netflix.discovery.DiscoveryClient - Registered Applications size is zero : true
08:27:23.253 [main] INFO  c.netflix.discovery.DiscoveryClient - Application version is -1: true
08:27:23.254 [main] INFO  c.netflix.discovery.DiscoveryClient - Getting all instance registry info from the eureka server
08:27:24.262 [main] INFO  c.netflix.discovery.DiscoveryClient - The response status is 200
08:27:24.290 [main] INFO  c.netflix.discovery.DiscoveryClient - Starting heartbeat executor: renew interval is: 30
08:27:24.296 [main] INFO  c.n.discovery.InstanceInfoReplicator - InstanceInfoReplicator onDemand update allowed rate per min is 4
08:27:24.312 [main] INFO  c.netflix.discovery.DiscoveryClient - Discovery Client initialized at timestamp 1561645644309 with initial instances count: 5
08:27:24.339 [DiscoveryClient-InstanceInfoReplicator-0] INFO  o.s.c.c.c.ConfigServicePropertySourceLocator - Fetching config from server at : http://ec2-54-229-194-72.eu-west-1.compute.amazonaws.com:8000/
08:27:24.345 [main] INFO  o.s.c.n.e.s.EurekaServiceRegistry - Registering application AUTH-SERVER with eureka with status UP
08:27:24.348 [main] INFO  c.netflix.discovery.DiscoveryClient - Saw local status change event StatusChangeEvent [timestamp=1561645644348, current=UP, previous=STARTING]
08:27:24.354 [main] WARN  c.n.discovery.InstanceInfoReplicator - Ignoring onDemand update due to rate limiter
08:27:24.502 [main] INFO  org.xnio - XNIO version 3.3.8.Final
08:27:24.567 [main] INFO  org.xnio.nio - XNIO NIO Implementation Version 3.3.8.Final
08:27:24.985 [main] INFO  o.s.b.w.e.u.UndertowServletWebServer - Undertow started on port(s) 8083 (http) with context path ''
08:27:24.988 [main] INFO  o.s.c.n.e.s.EurekaAutoServiceRegistration - Updating port to 8083
08:27:24.996 [main] INFO  c.passid.auth.AuthServerApplication - Started AuthServerApplication in 41.62 seconds (JVM running for 46.211)
08:27:25.733 [DiscoveryClient-InstanceInfoReplicator-0] INFO  o.s.c.c.c.ConfigServicePropertySourceLocator - Located environment: name=auth-server, profiles=[dev], label=null, version=22f0fc4af71ab5443315c1b7a1e9d30bc78dca6b, state=null
08:27:25.958 [DiscoveryClient-InstanceInfoReplicator-0] INFO  c.netflix.discovery.DiscoveryClient - DiscoveryClient_AUTH-SERVER/10.0.2.15:auth-server:8083: registering service...
08:27:26.200 [DiscoveryClient-InstanceInfoReplicator-0] INFO  c.netflix.discovery.DiscoveryClient - DiscoveryClient_AUTH-SERVER/10.0.2.15:auth-server:8083 - registration status: 204
08:28:38.277 [XNIO-1 task-1] INFO  io.undertow.servlet - Initializing Spring DispatcherServlet 'dispatcherServlet'
08:28:38.282 [XNIO-1 task-1] INFO  o.s.web.servlet.DispatcherServlet - Initializing Servlet 'dispatcherServlet'
08:28:38.350 [XNIO-1 task-1] INFO  o.s.web.servlet.DispatcherServlet - Completed initialization in 67 ms
AUTH-SERVER (10.0.2.15:auth-server:8083) : appName AUTH-SERVER
AUTH-SERVER (22222ecb6698:auth-server:8080) : appName AUTH-SERVER
DISCOVERY-SERVER (434451dcb5c4:discovery-server:8002) : appName DISCOVERY-SERVER
DB-SERVER (5a8bab920671:db-server:8080) : appNameDB-SERVER
ACCOUNT-SERVER (580de56ac0a7:account-server:8080) : appName ACCOUNT-SERVER
GATEWAY-SERVER (46ad9c38aadc:gateway-server:8081) : appName GATEWAY-SERVER
08:28:39.752 [XNIO-1 task-1] INFO  c.n.config.ChainedDynamicProperty - Flipping property: account-server.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647
08:28:39.981 [XNIO-1 task-1] INFO  c.n.u.c.ShutdownEnabledTimer - Shutdown hook installed for: NFLoadBalancer-PingTimer-account-server
08:28:39.987 [XNIO-1 task-1] INFO  c.n.loadbalancer.BaseLoadBalancer - Client: account-server instantiated a LoadBalancer: DynamicServerListLoadBalancer:{NFLoadBalancer:name=account-server,current list of Servers=[],Load balancer stats=Zone stats: {},Server stats: []}ServerList:null
08:28:40.132 [XNIO-1 task-1] INFO  c.n.l.DynamicServerListLoadBalancer - Using serverListUpdater PollingServerListUpdater
08:28:40.332 [XNIO-1 task-1] INFO  c.n.config.ChainedDynamicProperty - Flipping property: account-server.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647
08:28:40.345 [XNIO-1 task-1] INFO  c.n.l.DynamicServerListLoadBalancer - DynamicServerListLoadBalancer for client account-server initialized: DynamicServerListLoadBalancer:{NFLoadBalancer:name=account-server,current list of Servers=[172.17.0.5:8080],Load balancer stats=Zone stats: {defaultzone=[Zone:defaultzone;   Instance count:1;   Active connections count: 0;    Circuit breaker tripped count: 0;   Active connections per server: 0.0;]
},Server stats: [[Server:172.17.0.5:8080;   Zone:defaultZone;   Total Requests:0;   Successive connection failure:0;    Total blackout seconds:0;   Last connection made:Wed Dec 31 18:00:00 CST 1969;  First connection made: Wed Dec 31 18:00:00 CST 1969;    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]
]}ServerList:org.springframework.cloud.netflix.ribbon.eureka.DomainExtractingServerList@9c0e8c3
08:28:41.136 [PollingServerListUpdater-0] INFO  c.n.config.ChainedDynamicProperty - Flipping property: account-server.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647
08:28:43.400 [XNIO-1 task-1] ERROR io.undertow.request - UT005023: Exception handling request to /foo/foo
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is feign.RetryableException: connect timed out executing GET http://account-server/deviceToken/erlO7ph4s8M%3AAPA91bFAkOg_tX9xRbpuWjLIhK11kE4u3cLfxCG64l3IiC5DAeNVoVW7qIxlEu_1bLlt-nYycBU4VidDgx6v4w5_Rvc12NPv9p5XZup08Ert8hVREuWfKoc713QzlsO_LPEUkq-cDcvw
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1013)
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:897)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:645)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:750)
    at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)
    at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)
    at org.springframework.boot.actuate.web.trace.servlet.HttpTraceFilter.doFilterInternal(HttpTraceFilter.java:90)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
    at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
    at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
    at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
    at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
    at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
    at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
    at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
    at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:117)
    at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:106)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
    at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
    at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
    at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
    at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
    at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68)
    at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
    at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:132)
    at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
    at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
    at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
    at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
    at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292)
    at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81)
    at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138)
    at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135)
    at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
    at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
    at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272)
    at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
    at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104)
    at io.undertow.server.Connectors.executeRootHandler(Connectors.java:360)
    at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:830)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: feign.RetryableException: connect timed out executing GET http://account-server/deviceToken/erlO7ph4s8M%3AAPA91bFAkOg_tX9xRbpuWjLIhK11kE4u3cLfxCG64l3IiC5DAeNVoVW7qIxlEu_1bLlt-nYycBU4VidDgx6v4w5_Rvc12NPv9p5XZup08Ert8hVREuWfKoc713QzlsO_LPEUkq-cDcvw
    at feign.FeignException.errorExecuting(FeignException.java:84)
    at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:113)
    at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:78)
    at feign.ReflectiveFeign$FeignInvocationHandler.invoke(ReflectiveFeign.java:103)
    at com.sun.proxy.$Proxy109.getAccountByDeviceToken(Unknown Source)
    at com.passid.auth.rest.FooTest.addAuth(FooTest.java:34)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:189)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:800)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1038)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005)
    ... 59 common frames omitted
Caused by: java.net.SocketTimeoutException: connect timed out
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    at java.net.Socket.connect(Socket.java:589)
    at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
    at sun.net.www.http.HttpClient.<init>(HttpClient.java:242)
    at sun.net.www.http.HttpClient.New(HttpClient.java:339)
    at sun.net.www.http.HttpClient.New(HttpClient.java:357)
    at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1220)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1156)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1050)
    at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:984)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1564)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
    at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
    at feign.Client$Default.convertResponse(Client.java:143)
    at feign.Client$Default.execute(Client.java:68)
    at org.springframework.cloud.openfeign.ribbon.FeignLoadBalancer.execute(FeignLoadBalancer.java:90)
    at org.springframework.cloud.openfeign.ribbon.FeignLoadBalancer.execute(FeignLoadBalancer.java:56)
    at com.netflix.client.AbstractLoadBalancerAwareClient$1.call(AbstractLoadBalancerAwareClient.java:104)
    at com.netflix.loadbalancer.reactive.LoadBalancerCommand$3$1.call(LoadBalancerCommand.java:303)
    at com.netflix.loadbalancer.reactive.LoadBalancerCommand$3$1.call(LoadBalancerCommand.java:287)
    at rx.internal.util.ScalarSynchronousObservable$3.call(ScalarSynchronousObservable.java:231)
    at rx.internal.util.ScalarSynchronousObservable$3.call(ScalarSynchronousObservable.java:228)
    at rx.Observable.unsafeSubscribe(Observable.java:10151)
    at rx.internal.operators.OnSubscribeConcatMap$ConcatMapSubscriber.drain(OnSubscribeConcatMap.java:286)
    at rx.internal.operators.OnSubscribeConcatMap$ConcatMapSubscriber.onNext(OnSubscribeConcatMap.java:144)
    at com.netflix.loadbalancer.reactive.LoadBalancerCommand$1.call(LoadBalancerCommand.java:185)
    at com.netflix.loadbalancer.reactive.LoadBalancerCommand$1.call(LoadBalancerCommand.java:180)
    at rx.Observable.unsafeSubscribe(Observable.java:10151)
    at rx.internal.operators.OnSubscribeConcatMap.call(OnSubscribeConcatMap.java:94)
    at rx.internal.operators.OnSubscribeConcatMap.call(OnSubscribeConcatMap.java:42)
    at rx.Observable.unsafeSubscribe(Observable.java:10151)
    at rx.internal.operators.OperatorRetryWithPredicate$SourceSubscriber$1.call(OperatorRetryWithPredicate.java:127)
    at rx.internal.schedulers.TrampolineScheduler$InnerCurrentThreadScheduler.enqueue(TrampolineScheduler.java:73)
    at rx.internal.schedulers.TrampolineScheduler$InnerCurrentThreadScheduler.schedule(TrampolineScheduler.java:52)
    at rx.internal.operators.OperatorRetryWithPredicate$SourceSubscriber.onNext(OperatorRetryWithPredicate.java:79)
    at rx.internal.operators.OperatorRetryWithPredicate$SourceSubscriber.onNext(OperatorRetryWithPredicate.java:45)
    at rx.internal.util.ScalarSynchronousObservable$WeakSingleProducer.request(ScalarSynchronousObservable.java:276)
    at rx.Subscriber.setProducer(Subscriber.java:209)
    at rx.internal.util.ScalarSynchronousObservable$JustOnSubscribe.call(ScalarSynchronousObservable.java:138)
    at rx.internal.util.ScalarSynchronousObservable$JustOnSubscribe.call(ScalarSynchronousObservable.java:129)
    at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
    at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
    at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
    at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
    at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
    at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
    at rx.Observable.subscribe(Observable.java:10247)
    at rx.Observable.subscribe(Observable.java:10214)
    at rx.observables.BlockingObservable.blockForSingle(BlockingObservable.java:444)
    at rx.observables.BlockingObservable.single(BlockingObservable.java:341)
    at com.netflix.client.AbstractLoadBalancerAwareClient.executeWithLoadBalancer(AbstractLoadBalancerAwareClient.java:112)
    at org.springframework.cloud.openfeign.ribbon.LoadBalancerFeignClient.execute(LoadBalancerFeignClient.java:65)
    at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:108)
    ... 76 common frames omitted

Thanks

Sled answered 27/6, 2019 at 1:15 Comment(13)
It seems that you developed a service A to communicate with the other service B with Feign client, and both services were registered to Eureka server. And that's why you visit http://localhost:8083/foo/foo, the Feign client will send HTTP request to http://account-server/deviceToken/xx.Send
foo/foo is the class FooTest for testing purpose which only have the Feign client, then this Feign client is trying to get the data from account-server/deviceToken/xx. which is incorrect. ICalifate
Will you please update the question with the eureka server config and the eureka config of service B?Voleta
@MareGeldenhuys sure thing. I just didCalifate
If you click on the green link in the Eureka service, which url is shown in your browser?Voleta
Please provide the full exceptionDisject
@Disject I just did. ThanksCalifate
Not sure, looks like account-server is not getting replaced with a host and port. I'd need a project that recreates the problem.Disject
Why service A was not listed in Eureka server..??Hibernicism
possible duplicate of: #52696791Bye
@Daniel Hernández did you get solution?Masson
@Masson I remember I did, it was related with hystrix If I'm not wrong, but I don't remember clearly that project is part of the past :(Califate
Answer is already given : https://mcmap.net/q/1217054/-feignclient-not-resolving-eureka-service-nameCohort

© 2022 - 2024 — McMap. All rights reserved.