java.util.concurrent.TimeoutException: Did not observe any item or terminal signal within 10000ms in 'map' (and no fallback has been configured)
Asked Answered
A

1

1

I'm building the Spring Boot Admin code and getting the below error.

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.4.2</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.example</groupId>
    <artifactId>admin-server</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>admin-server</name>
    <description>Demo project for Spring Boot</description>
    <properties>
        <java.version>1.8</java.version>
        <spring-boot-admin.version>2.3.1</spring-boot-admin.version>
        <spring-cloud.version>2020.0.2</spring-cloud.version>
    </properties>
    <dependencies>
        <!-- Spring Boot Admin -->
        <dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-starter-server</artifactId>
        </dependency>
        <dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-server-ui</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-bootstrap</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-config</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
        </dependency>
        
        <!-- Third-party librairies -->
        <dependency>
            <groupId>org.jolokia</groupId>
            <artifactId>jolokia-core</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>${spring-cloud.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>de.codecentric</groupId>
                <artifactId>spring-boot-admin-dependencies</artifactId>
                <version>${spring-boot-admin.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

bootstrap.yml

spring:
  cloud:
    config:
      enabled: true
      uri: http://localhost:9296
      
  application:
    name: admin-server
    
server:
  port: 9090
  
eureka:
  client:
    register-with-eureka: true
    fetch-registry: true
  instance:
    hostname: localhost
    prefer-ip-address: true

AdminServerApplication.java

@SpringBootApplication
@EnableAdminServer
@EnableEurekaClient
public class AdminServerApplication {

    public static void main(String[] args) {
        SpringApplication.run(AdminServerApplication.class, args);
    }

}

Error:

2021-05-04 13:39:12.290  WARN 36752 --- [ctor-http-nio-1] io.netty.resolver.dns.DnsQueryContext    : Received a mismatching DNS response: DatagramDnsResponse(from: /172.30.160.1:53, to: /0:0:0:0:0:0:0:0:56414, 52280, QUERY(0), NoError(0), RD RA)
    DefaultDnsQuestion(XXXXXXXXorg. IN A)
    DefaultDnsRawRecord(XXXXXXXXorg. 171 IN A 4B)
    DefaultDnsRawRecord(OPT flags:0 udp:4096 0B)
2021-05-04 13:39:12.882  INFO 36752 --- [           main] com.example.demo.AdminServerApplication  : Started AdminServerApplication in 6.649 seconds (JVM running for 7.875)
2021-05-04 13:39:17.355  WARN 36752 --- [ctor-http-nio-1] io.netty.resolver.dns.DnsQueryContext    : Received a mismatching DNS response: DatagramDnsResponse(from: /172.30.160.1:53, to: /0:0:0:0:0:0:0:0:56414, 3238, QUERY(0), NoError(0), RD AA RA)
    DefaultDnsQuestion(XXXXXXXXorg. IN CNAME)
    DefaultDnsRawRecord(corp.mastercard.org. 3600 IN SOA 56B)
    DefaultDnsRawRecord(OPT flags:0 udp:4000 0B)
2021-05-04 13:39:22.211  INFO 36752 --- [     parallel-5] d.c.b.a.server.services.StatusUpdater    : Couldn't retrieve status for Instance(id=162455d08d2a, version=0, registration=Registration(name=CONFIG-SERVER, managementUrl=http://XXXXXXXXorg:9296/actuator, healthUrl=http://XXXXXXXXorg:9296/actuator/health, serviceUrl=http://XXXXXXXXorg:9296, source=discovery), registered=true, statusInfo=StatusInfo(status=UNKNOWN, details={}), statusTimestamp=2021-05-04T08:09:12.195Z, info=Info(values={}), endpoints=Endpoints(endpoints={health=Endpoint(id=health, url=http://XXXXXXXXorg:9296/actuator/health)}), buildVersion=null, tags=Tags(values={}))

java.util.concurrent.TimeoutException: Did not observe any item or terminal signal within 10000ms in 'map' (and no fallback has been configured)
    at reactor.core.publisher.FluxTimeout$TimeoutMainSubscriber.handleTimeout(FluxTimeout.java:294) ~[reactor-core-3.4.2.jar:3.4.2]
    Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: 
Error has been observed at the following site(s):
    |_ checkpoint ⇢ Request to GET health [DefaultWebClient]
Stack trace:
        at reactor.core.publisher.FluxTimeout$TimeoutMainSubscriber.handleTimeout(FluxTimeout.java:294) ~[reactor-core-3.4.2.jar:3.4.2]
        at reactor.core.publisher.FluxTimeout$TimeoutMainSubscriber.doTimeout(FluxTimeout.java:279) ~[reactor-core-3.4.2.jar:3.4.2]
        at reactor.core.publisher.FluxTimeout$TimeoutTimeoutSubscriber.onNext(FluxTimeout.java:418) ~[reactor-core-3.4.2.jar:3.4.2]
        at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onNext(FluxOnErrorResume.java:79) ~[reactor-core-3.4.2.jar:3.4.2]
        at reactor.core.publisher.MonoDelay$MonoDelayRunnable.run(MonoDelay.java:119) ~[reactor-core-3.4.2.jar:3.4.2]
        at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:68) ~[reactor-core-3.4.2.jar:3.4.2]
        at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:28) ~[reactor-core-3.4.2.jar:3.4.2]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[na:1.8.0_171]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) ~[na:1.8.0_171]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) ~[na:1.8.0_171]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[na:1.8.0_171]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[na:1.8.0_171]
        at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_171]
Azoic answered 4/5, 2021 at 8:15 Comment(0)
A
4

I was able to solve this issue. Basically all your microservices should use below configuration. Here prefer-ip-address: true and fetch-registry: true is the key here.

server:
  port: 8002

spring:
  application:
    name: user-service
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://localhost:3306/test
    username: root
    password: root
    
  jpa:
    generate-ddl: true
    hibernate:
      ddl-auto: create
 
#  zipkin:
#    base-url: http://127.0.0.1:9411/

eureka:
  client:
    register-with-eureka: true
    fetch-registry: true
  instance:
    prefer-ip-address: true
    hostname: localhost
    
Azoic answered 4/5, 2021 at 8:45 Comment(1)
any explanation, or reason for this ?Ravens

© 2022 - 2024 — McMap. All rights reserved.