question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Document Missing Property To Use WebClient

See original GitHub issue

Describe the bug Spring Cloud Config Client app running on Spring WebFlux reactive stack is unable to locate Cloud Config Server via Eureka Discovery, so it defaults to http://localhost:8888. (The Cloud Config Server is a traditional Spring MVC app running on servlet stack.) I’ve migrated my Config Client app from MVC to WebFlux, and Eureka Discovery of downstream services is still working (and I’m using ReactorLoadBalancerExchangeFilterFunction), but Cloud Config is no longer working.

Sample Stack trace:

WARN  2021-04-10 00:11:30,450 [main] org.springframework.cloud.config.client.DiscoveryClientConfigServiceBootstrapConfiguration app=testapp version=2.0.1.0 : Could not locate configserver via discovery
org.springframework.web.client.UnknownContentTypeException: Could not extract response: no suitable HttpMessageConverter found for response type [class org.springframework.cloud.netflix.eureka.http.EurekaApplications] and content type [application/xml]
	at org.springframework.web.client.HttpMessageConverterExtractor.extractData(HttpMessageConverterExtractor.java:126) ~[spring-web-5.2.13.RELEASE.jar!/:5.2.13.RELEASE]
	at org.springframework.web.client.RestTemplate$ResponseEntityResponseExtractor.extractData(RestTemplate.java:996) ~[spring-web-5.2.13.RELEASE.jar!/:5.2.13.RELEASE]
	at org.springframework.web.client.RestTemplate$ResponseEntityResponseExtractor.extractData(RestTemplate.java:979) ~[spring-web-5.2.13.RELEASE.jar!/:5.2.13.RELEASE]
	at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:739) ~[spring-web-5.2.13.RELEASE.jar!/:5.2.13.RELEASE]
	at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:672) ~[spring-web-5.2.13.RELEASE.jar!/:5.2.13.RELEASE]
	at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:581) ~[spring-web-5.2.13.RELEASE.jar!/:5.2.13.RELEASE]
	at org.springframework.cloud.netflix.eureka.http.RestTemplateEurekaHttpClient.getApplicationsInternal(RestTemplateEurekaHttpClient.java:158) ~[spring-cloud-netflix-eureka-client-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
	at org.springframework.cloud.netflix.eureka.http.RestTemplateEurekaHttpClient.getApplications(RestTemplateEurekaHttpClient.java:146) ~[spring-cloud-netflix-eureka-client-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
	at org.springframework.cloud.netflix.eureka.config.EurekaConfigServerBootstrapConfiguration.lambda$eurekaConfigServerInstanceProvider$0(EurekaConfigServerBootstrapConfiguration.java:112) ~[spring-cloud-netflix-eureka-client-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
	at org.springframework.cloud.config.client.ConfigServerInstanceProvider.getConfigServerInstances(ConfigServerInstanceProvider.java:50) ~[spring-cloud-config-client-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
	at org.springframework.cloud.config.client.DiscoveryClientConfigServiceBootstrapConfiguration$HeartbeatListener.refresh(DiscoveryClientConfigServiceBootstrapConfiguration.java:123) ~[spring-cloud-config-client-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
	at org.springframework.cloud.config.client.DiscoveryClientConfigServiceBootstrapConfiguration$HeartbeatListener.startup(DiscoveryClientConfigServiceBootstrapConfiguration.java:109) ~[spring-cloud-config-client-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
	at org.springframework.cloud.config.client.DiscoveryClientConfigServiceBootstrapConfiguration$HeartbeatListener.onApplicationEvent(DiscoveryClientConfigServiceBootstrapConfiguration.java:101) ~[spring-cloud-config-client-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) ~[spring-context-5.2.13.RELEASE.jar!/:5.2.13.RELEASE]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) ~[spring-context-5.2.13.RELEASE.jar!/:5.2.13.RELEASE]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) ~[spring-context-5.2.13.RELEASE.jar!/:5.2.13.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:404) ~[spring-context-5.2.13.RELEASE.jar!/:5.2.13.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:361) ~[spring-context-5.2.13.RELEASE.jar!/:5.2.13.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:898) ~[spring-context-5.2.13.RELEASE.jar!/:5.2.13.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:554) ~[spring-context-5.2.13.RELEASE.jar!/:5.2.13.RELEASE]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758) ~[spring-boot-2.3.9.RELEASE.jar!/:2.3.9.RELEASE]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750) ~[spring-boot-2.3.9.RELEASE.jar!/:2.3.9.RELEASE]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:405) ~[spring-boot-2.3.9.RELEASE.jar!/:2.3.9.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[spring-boot-2.3.9.RELEASE.jar!/:2.3.9.RELEASE]
	at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:140) ~[spring-boot-2.3.9.RELEASE.jar!/:2.3.9.RELEASE]
	at org.springframework.cloud.bootstrap.BootstrapApplicationListener.bootstrapServiceContext(BootstrapApplicationListener.java:212) ~[spring-cloud-context-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
	at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:117) ~[spring-cloud-context-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
	at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:74) ~[spring-cloud-context-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) ~[spring-context-5.2.13.RELEASE.jar!/:5.2.13.RELEASE]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) ~[spring-context-5.2.13.RELEASE.jar!/:5.2.13.RELEASE]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) ~[spring-context-5.2.13.RELEASE.jar!/:5.2.13.RELEASE]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127) ~[spring-context-5.2.13.RELEASE.jar!/:5.2.13.RELEASE]
	at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:80) ~[spring-boot-2.3.9.RELEASE.jar!/:2.3.9.RELEASE]
	at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:53) ~[spring-boot-2.3.9.RELEASE.jar!/:2.3.9.RELEASE]
	at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:345) ~[spring-boot-2.3.9.RELEASE.jar!/:2.3.9.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) ~[spring-boot-2.3.9.RELEASE.jar!/:2.3.9.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237) ~[spring-boot-2.3.9.RELEASE.jar!/:2.3.9.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) ~[spring-boot-2.3.9.RELEASE.jar!/:2.3.9.RELEASE]
	at com.company.testapp.Application.main(Application.java:21) ~[classes!/:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
	at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) ~[app.jar:?]
	at org.springframework.boot.loader.Launcher.launch(Launcher.java:107) ~[app.jar:?]
	at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) ~[app.jar:?]
	at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88) ~[app.jar:?]
 INFO  2021-04-10 00:11:30,667 [main] org.springframework.cloud.config.client.ConfigServicePropertySourceLocator app=testapp version=2.0.1.0 : Fetching config from server at : http://localhost:8888
 INFO  2021-04-10 00:11:30,676 [main] org.springframework.cloud.config.client.ConfigServicePropertySourceLocator app=testapp version=2.0.1.0 : Connect Timeout Exception on Url - http://localhost:8888. Will be trying the next url if available
 WARN  2021-04-10 00:11:30,676 [main] org.springframework.cloud.config.client.ConfigServicePropertySourceLocator app=testapp version=2.0.1.0 : Could not locate PropertySource: I/O error on GET request for "http://localhost:8888/testapp/test": Connection refused (Connection refused); nested exception is java.net.ConnectException: Connection refused (Connection refused)
 INFO  2021-04-10 00:11:30,679 [main] com.company.testapp.Application app=testapp version=2.0.1.0 : The following profiles are active: test

Versions:

springBootVersion = '2.3.9.RELEASE'
springCloudVersion = 'Hoxton.SR10'
reactorAddonsVersion = '3.3.5.RELEASE'
reactorCoreVersion = '3.3.13.RELEASE'
reactorNettyVersion = '0.9.16.RELEASE'

Dependencies:

implementation("org.springframework.boot:spring-boot-starter-actuator")
annotationProcessor("org.springframework.boot:spring-boot-starter-log4j2")
implementation("org.springframework.boot:spring-boot-starter-log4j2")
implementation('org.springframework.boot:spring-boot-starter-webflux')
implementation("org.springframework.cloud:spring-cloud-starter-loadbalancer")
implementation("org.springframework.cloud:spring-cloud-starter-netflix-eureka-client")
implementation("org.springframework.cloud:spring-cloud-starter-netflix-ribbon")
implementation("org.springframework.cloud:spring-cloud-config-client")
implementation("org.springframework.cloud:spring-cloud-starter-config")
implementation('org.springframework.cloud:spring-cloud-starter-hystrix'
compileOnly "org.springframework.boot:spring-boot-configuration-processor"
implementation("io.projectreactor.netty:reactor-netty:${reactorNettyVersion}")
implementation("io.projectreactor:reactor-core:${reactorCoreVersion}")
implementation("io.projectreactor.addons:reactor-extra:${reactorAddonsVersion}")

Bootstrap properties:

# Spring Cloud properties
spring.cloud.config.discovery.enabled=true
spring.cloud.config.discovery.serviceId=deliver-myconfigserver-v1
eureka.client.eurekaServerURLContext=eureka/v2
eureka.client.eurekaServerPort=8080
eureka.client.useDnsForFetchingServiceUrls=true
eureka.client.eurekaServerDNSName=eureka.\${CLOUD_ENVIRONMENT}.company.com

Application properties:

spring.cloud.loadbalancer.ribbon.enabled=false
spring.cloud.discovery.enabled=true
spring.cloud.discovery.reactive.enabled=true

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
dibaggiojcommented, Sep 28, 2021

Ok, got it, thanks for the quick reply @ryanjbaxter.

0reactions
ryanjbaxtercommented, Sep 28, 2021

It would effect all WebClients.

You could provide your own Builder bean https://github.com/spring-cloud/spring-cloud-netflix/blob/98048189dd7ce85f503838abb58cf9fca8a78d1c/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/config/DiscoveryClientOptionalArgsConfiguration.java#L114

But IDK if that helps in your case, it might depend on how you designed your application and where these services are getting a WebClient instance from.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Document Missing Property To Use WebClient #1862 - GitHub
Describe the bug Spring Cloud Config Client app running on Spring WebFlux reactive stack is unable to locate Cloud Config Server via Eureka ......
Read more >
Spring 5 WebClient using ssl - Stack Overflow
5 Answers 5 ; SslContextBuilder.forClient() .trustManager(InsecureTrustManagerFactory.INSTANCE) .build(); HttpClient httpClient ; HttpClient.
Read more >
Unable to access VMware vCenter Support Assistant in ...
To work around this issue, add the line scriptPlugin.enabled=true to the webclient.properties file. Note: This resolution can cause vSphere Data ...
Read more >
Spring 5 WebClient and WebTestClient Tutorial with Examples
Let's make things interesting and use WebClient to consume a Real World API. In this article, we'll consume Github's APIs using WebClient. We'll ......
Read more >
Missing Images on Certain Maximo Pages After Enabling ...
After setting webclient.useabsoluteimagepath to "true" in the /applications/maximo/properties/webclient.properties file , some pages have images (checkboxes, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found