Сервер Spring Cloud Eureka перезапускается сразу после запуска клиентского сервиса eureka. (После обновления JDK и Spring Boot версии.) - PullRequest
1 голос
/ 08 апреля 2020

Я разрабатываю набор микросервисов, которые обнаруживают друг друга с помощью сервера eureka.

Вчера я обновил наши проекты с JDK 1.8 до JDK 14 и адаптировал все номера версий зависимостей к самым последним. Я сейчас использую spring-boot-starter-parent в качестве родительского POM в версии 2.2.6.RELEASE.

Все проекты работают нормально, также проходят все модульные тесты. Однако сегодня я обнаружил, что обнаружение службы с помощью eureka больше не работает.

Для тестирования я обычно сначала запускаю свой сервер eureka и жду, пока он полностью загрузится. После этого я запускаю клиентов, чтобы они могли зарегистрироваться на него. Проблема заключается в следующем: как только я запускаю первую клиентскую службу, сервер eureka выключается и пытается перезапуститься, выдавая множество исключений, которых не было при первом запуске.

В конце концов, когда он Похоже, что все решено, я не могу позвонить своим службам, возможно, потому, что их невозможно обнаружить.


Вот некоторые подробности о моей настройке:

Я использую пользовательский родительский POM, полученный от spring-boot-starter-parent.

POM POM:

<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 http://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.2.6.RELEASE</version>
        <relativePath />
    </parent>

    <groupId>com.whatever</groupId>
    <artifactId>parent</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>pom</packaging>

    <properties>
        <java.version>14</java.version>
        <spring-cloud.version>Hoxton.RELEASE</spring-cloud.version>
<!-- Also tried these...
        <spring-cloud.version>Hoxton.SR1</spring-cloud.version>
        <spring-cloud.version>Hoxton.SR2</spring-cloud.version>
        <spring-cloud.version>Hoxton.SR3</spring-cloud.version>
-->
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-parent</artifactId>
                <version>${spring-cloud.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

 <!-- ... more stuff ... -->

</project>

POM моей службы сервера eureka выглядит следующим образом:

POM Eureka-Server:

<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.whatever</groupId>
        <artifactId>parent</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <relativePath/>
    </parent>

    <groupId>com.whatever</groupId>
    <artifactId>service-directory</artifactId>
    <version>0.0.1-SNAPSHOT</version>

    <properties>
        <java.version>14</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-configuration-processor</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <!-- version managed in parent POM -->
            </plugin>
        </plugins>
    </build>
</project>

Стоит отметить одну вещь: моя служба сервера eureka сама является клиентом eureka.

Это мой application.yml из службы сервера eureka:

приложение. yml сервера Eureka:

spring:
  profiles:
    active: test
  application:
    name: ServiceDirectory

server:
  port: 8099

logging.level:
    org.springframework:
      web: DEBUG
      web.servlet.view.freemarker.FreeMarkerConfigurer: INFO

eureka:
  client:
    service-url:
      defaultZone: http://localhost:${server.port}/eureka/

management:
  endpoint:
    health:
      show-details: always
  endpoints:
    web:
      exposure:
        include:
        - '*'

---

spring:
  profiles: test

spring.output.ansi.enabled: ALWAYS

В качестве примера для клиентского application.yml, это application.yml моей службы API-шлюза, который регистрируется на сервере eureka:

application.yml Eureka Client (API-шлюз):

spring:
  profiles:
    active: test
  application:
    name: gateway

server:
  port: 8088

eureka:
  client:
    service-url:
      defaultZone: http://localhost:8099/eureka/

---

spring:
  profiles: test

zuul:
  routes:
    service-a:
      path: /service-a/**
      url: http://localhost:8083
      sensitiveHeaders: 
      strip-prefix: true
    service-b:
      path: /service-b/**
      url: http://localhost:9920
      sensitiveHeaders: 
      strip-prefix: true
    service-directory:
      path: /service-directory/**
      url: http://localhost:8099
      sensitiveHeaders: 
      strip-prefix: true
    eureka-home:
      path: /eureka/**
      url: http://localhost:8099
      sensitiveHeaders: 
      strip-prefix: false

spring.output.ansi.enabled: ALWAYS      

Кажется, не имеет значения, какой клиентский сервис я запускаю.

Дайте мне знать, если вам нужно больше подробностей о настройке.

Вот вывод моего Сервер eureka:

Выход сервера Eureka 1:

 . ____ _ __ _ _
 /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/ ___)| |_)| | | | | || (_| | ) ) ) )
 ' |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot :: (v2.2.6.RELEASE)

13:22:18.244 c.w.s.ServiceDirectoryApplication : The following profiles are active: test
13:22:19.625 o.s.boot.actuate.endpoint.EndpointId : Endpoint ID 'service-registry' contains invalid characters, please migrate to a valid format.
...
13:22:20.769 c.netflix.config.DynamicPropertyFactory : DynamicPropertyFactory is initialized with configuration sources: com.netflix.config.ConcurrentCompositeConfiguration@235cb2ea
 WARNING: An illegal reflective access operation has occurred
 WARNING: Illegal reflective access by org.springframework.cglib.core.ReflectUtils (file:/home/xxx/.m2/repository/org/springframework/spring-core/5.2.1.RELEASE/spring-core-5.2.1.RELEASE.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
 WARNING: Please consider reporting this to the maintainers of org.springframework.cglib.core.ReflectUtils
 WARNING: Use --illegal-access= to enable ings of further illegal reflective access operations
 WARNING: All illegal access operations will be denied in a future release
13:22:21.412 c.s.j.s.i.a.WebApplicationImpl : Initiating Jersey application, version 'Jersey: 1.19.1 03/11/2016 02:08 PM'
...
13:22:23.207 ockingLoadBalancerClientRibbon Logger : You already have RibbonLoadBalancerClient on your classpath. It will be used by default. As Spring Cloud Ribbon is in maintenance mode. We recommend switching to BlockingLoadBalancerClient instead. In order to use it, set the value of `spring.cloud.loadbalancer.ribbon.enabled` to `false` or remove spring-cloud-starter-netflix-ribbon from your project.
13:22:23.237 iguration$LoadBalancerCaffeine Logger : Spring Cloud LoadBalancer is currently working with default default cache. You can switch to using Caffeine cache, by adding it to the classpath.
13:22:23.254 o.s.c.n.eureka.Instance Factory : Setting initial instance status as: STARTING
13:22:23.321 com.netflix.discovery.DiscoveryClient : Initializing Eureka in region us-east-1
...
13:22:23.601 com.netflix.discovery.DiscoveryClient : Getting all instance registry from the eureka server
13:22:23.655 ERROR c.n.d.s.t.d.RedirectingEurekaHttpClient : Request execution error. endpoint=DefaultEndpoint{ serviceUrl='http://localhost:8099/eureka/}

com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused
    at com.sun.jersey.client.apache4.ApacheHttpClient4Handler.handle(ApacheHttpClient4Handler.java:187) ~[jersey-apache-client4-1.19.1.jar:1.19.1]
    ...
    at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator$6.execute(EurekaHttpClientDecorator.java:137) ~[eureka-client-1.9.13.jar:1.9.13]
    ...
Caused by: java.net.ConnectException: Connection refused
    at java.base/sun.nio.ch.Net.pollConnect(Native Method) ~[na:na]
    ...
    at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:180) ~[httpclient-4.5.12.jar:4.5.12]
    ...

13:22:23.656 c.n.d.s.t.d.RetryableEurekaHttpClient : Request execution failed with message: java.net.ConnectException: Connection refused
13:22:23.658 ERROR com.netflix.discovery.DiscoveryClient : DiscoveryClient_SERVICEDIRECTORY/xxxComputer.fritz.box:ServiceDirectory:8099 - was unable to refresh its cache! status = Cannot execute request on any known server

com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server
    at com.netflix.discovery.shared.transport.decorator.RetryableEurekaHttpClient.execute(RetryableEurekaHttpClient.java:112) ~[eureka-client-1.9.13.jar:1.9.13]
    ...
    at org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration$RefreshableEurekaClientConfiguration.eurekaClient(EurekaClientAutoConfiguration.java:324) ~[spring-cloud-netflix-eureka-client-2.2.0.RELEASE.jar:2.2.0.RELEASE]
    ...
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) ~[spring-boot-devtools-2.2.6.RELEASE.jar:2.2.6.RELEASE]

13:22:23.659 com.netflix.discovery.DiscoveryClient : Using default backup registry implementation which does not do anything.
...
13:22:23.691 c.n.eureka.cluster.PeerEurekaNodes : Adding new peer nodes [http://localhost:8099/eureka/]
...
13:22:23.805 c.n.eureka.cluster.PeerEurekaNodes : Replica node URL: http://localhost:8099/eureka/
13:22:23.810 c.n.e.registry.AbstractInstanceRegistry : Finished initializing remote region registries. All known remote regions: []
13:22:23.811 c.n.eureka.DefaultEurekaServerContext : Initialized
13:22:23.854 o.s.c.n.e.s.EurekaServiceRegistry : Registering application SERVICEDIRECTORY with eureka with status UP
13:22:23.855 com.netflix.discovery.DiscoveryClient : Saw local status change event StatusChangeEvent [timestamp=1586344943855, current=UP, previous=STARTING]
13:22:23.857 com.netflix.discovery.DiscoveryClient : DiscoveryClient_SERVICEDIRECTORY/xxxComputer.fritz.box:ServiceDirectory:8099: registering service...
13:22:23.860 o.s.c.n.e.server.EurekaServerBootstrap : Setting the eureka configuration..
13:22:23.860 d.s.w.p.DocumentationPluginsBootstrapper : Context refreshed
13:22:23.860 o.s.c.n.e.server.EurekaServerBootstrap : Eureka data center value eureka.datacenter is not set, defaulting to default
13:22:23.861 o.s.c.n.e.server.EurekaServerBootstrap : Eureka environment value eureka.environment is not set, defaulting to test
13:22:23.863 c.n.d.s.t.d.RedirectingEurekaHttpClient : Request execution error. endpoint=DefaultEndpoint{ serviceUrl='http://localhost:8099/eureka/}

com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused
    ...
    at com.netflix.discovery.EurekaIdentityHeaderFilter.handle(EurekaIdentityHeaderFilter.java:27) ~[eureka-client-1.9.13.jar:1.9.13]
    at com.sun.jersey.api.client.Client.handle(Client.java:652) ~[jersey-client-1.19.1.jar:1.19.1]
    ...
    at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.register(EurekaHttpClientDecorator.java:56) ~[eureka-client-1.9.13.jar:1.9.13]
    ...
Caused by: java.net.ConnectException: Connection refused
    ...
 ...

13:22:23.864 c.n.d.s.t.d.RetryableEurekaHttpClient : Request execution failed with message: java.net.ConnectException: Connection refused
13:22:23.869 com.netflix.discovery.DiscoveryClient : DiscoveryClient_SERVICEDIRECTORY/xxxComputer.fritz.box:ServiceDirectory:8099 - registration failed Cannot execute request on any known server

com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server
    at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator$1.execute(EurekaHttpClientDecorator.java:59) ~[eureka-client-1.9.13.jar:1.9.13]
    ...

13:22:23.870 c.n.discovery.Instance Replicator : There was a problem with the instance replicator

com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server
    at com.netflix.discovery.shared.transport.decorator.RetryableEurekaHttpClient.execute(RetryableEurekaHttpClient.java:112) ~[eureka-client-1.9.13.jar:1.9.13]
    ...

...
13:22:24.193 o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8099 (http) with context path ''
13:22:24.194 .s.c.n.e.s.EurekaAutoServiceRegistration : Updating port to 8099
13:22:24.197 c.w.s.ServiceDirectoryApplication : Started ServiceDirectoryApplication in 6.846 seconds (JVM running for 7.369)

Это вывод, который он производит сам, без запуска какой-либо другой службы.

После того, как он запущен для в то же время он добавляет дополнительные выходные данные, например:

Eureka server output 2:

13:22:53.662 com.netflix.discovery.DiscoveryClient : Disable delta property : false
...
13:22:53.783 c.n.e.registry.AbstractInstanceRegistry : DS: Registry: lease doesn't exist, registering resource: SERVICEDIRECTORY - xxxComputer.fritz.box:ServiceDirectory:8099
13:22:53.783 c.n.eureka.resources.InstanceResource : Not Found (Renew): SERVICEDIRECTORY - xxxComputer.fritz.box:ServiceDirectory:8099
13:22:53.803 com.netflix.discovery.DiscoveryClient : DiscoveryClient_SERVICEDIRECTORY/xxxComputer.fritz.box:ServiceDirectory:8099 - Re-registering apps/SERVICEDIRECTORY
13:22:53.804 com.netflix.discovery.DiscoveryClient : DiscoveryClient_SERVICEDIRECTORY/xxxComputer.fritz.box:ServiceDirectory:8099: registering service...
13:22:53.815 com.netflix.discovery.DiscoveryClient : The response status is 200
...
13:22:53.856 c.n.e.registry.AbstractInstanceRegistry : Registered instance SERVICEDIRECTORY/xxxComputer.fritz.box:ServiceDirectory:8099 with status UP (replication=false)
13:22:53.859 com.netflix.discovery.DiscoveryClient : DiscoveryClient_SERVICEDIRECTORY/xxxComputer.fritz.box:ServiceDirectory:8099 - registration status: 204
...
13:22:54.398 c.n.e.registry.AbstractInstanceRegistry : Registered instance SERVICEDIRECTORY/xxxComputer.fritz.box:ServiceDirectory:8099 with status UP (replication=true)
13:23:23.817 com.netflix.discovery.DiscoveryClient : Disable delta property : false
...
13:23:23.824 o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped to ResourceHttpRequestHandler ["classpath:/META-INF/resources/", "classpath:/resources/", "classpath:/static/", "classpath:/public/", "/"]
13:23:23.829 com.netflix.discovery.DiscoveryClient : The response status is 200
13:23:23.867 o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped to ResourceHttpRequestHandler ["classpath:/META-INF/resources/", "classpath:/resources/", "classpath:/static/", "classpath:/public/", "/"]
13:23:23.881 c.n.e.registry.AbstractInstanceRegistry : Registered instance SERVICEDIRECTORY/xxxComputer.fritz.box:ServiceDirectory:8099 with status UP (replication=true)
13:23:23.881 c.n.e.r.PeerAwareInstanceRegistryImpl : Got 1 instances from neighboring DS node
13:23:23.881 c.n.e.r.PeerAwareInstanceRegistryImpl : Renew threshold is: 1
13:23:23.881 c.n.e.r.PeerAwareInstanceRegistryImpl : Changing status to UP
13:23:23.893 e.s.EurekaServerInitializerConfiguration : Started Eureka Server
13:23:24.385 o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped to ResourceHttpRequestHandler ["classpath:/META-INF/resources/", "classpath:/resources/", "classpath:/static/", "classpath:/public/", "/"]

Я могу позволить ему работать столько, сколько я хочу. Как только я запускаю другую службу, в выводе сервера eureka выводится следующее:

Вывод ошибки сервера Eureka:

13:24:25.899 o.s.c.n.e.s.EurekaServiceRegistry : Unregistering application SERVICEDIRECTORY with eureka with status DOWN
13:24:25.899 com.netflix.discovery.DiscoveryClient : Saw local status change event StatusChangeEvent [timestamp=1586345065899, current=DOWN, previous=UP]
13:24:25.900 com.netflix.discovery.DiscoveryClient : DiscoveryClient_SERVICEDIRECTORY/xxxComputer.fritz.box:ServiceDirectory:8099: registering service...
13:24:25.903 c.n.eureka.DefaultEurekaServerContext : Shutting down ...
13:24:25.907 o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped to ResourceHttpRequestHandler ["classpath:/META-INF/resources/", "classpath:/resources/", "classpath:/static/", "classpath:/public/", "/"]
13:24:25.908 c.n.eureka.DefaultEurekaServerContext : Shut down
13:24:25.910 c.n.e.registry.AbstractInstanceRegistry : Registered instance SERVICEDIRECTORY/xxxComputer.fritz.box:ServiceDirectory:8099 with status DOWN (replication=false)
13:24:25.911 o.s.b.f.support.DisposableBeanAdapter : Invocation of destroy method failed on bean with name 'tomcatMetricsBinder': java.lang.NoSuchMethodError: 'void io.micrometer.core.instrument.binder.tomcat.TomcatMetrics.close()'
13:24:25.912 com.netflix.discovery.DiscoveryClient : DiscoveryClient_SERVICEDIRECTORY/xxxComputer.fritz.box:ServiceDirectory:8099 - registration status: 204
13:24:25.913 o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor'
13:24:25.923 com.netflix.discovery.DiscoveryClient : Shutting down DiscoveryClient ...
13:24:28.924 com.netflix.discovery.DiscoveryClient : Unregistering ...
13:24:28.930 o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped to ResourceHttpRequestHandler ["classpath:/META-INF/resources/", "classpath:/resources/", "classpath:/static/", "classpath:/public/", "/"]
13:24:28.933 c.n.e.registry.AbstractInstanceRegistry : Cancelled instance SERVICEDIRECTORY/xxxComputer.fritz.box:ServiceDirectory:8099 (replication=false)
13:24:28.935 com.netflix.discovery.DiscoveryClient : DiscoveryClient_SERVICEDIRECTORY/xxxComputer.fritz.box:ServiceDirectory:8099 - deregister status: 200
13:24:28.953 com.netflix.discovery.DiscoveryClient : Completed shut down of DiscoveryClient
13:24:29.111 trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)

 . ____ _ __ _ _
 /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/ ___)| |_)| | | | | || (_| | ) ) ) )
 ' |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot :: (v2.2.6.RELEASE)

13:24:29.170 c.w.s.ServiceDirectoryApplication : The following profiles are active: test
...
13:24:31.186 com.netflix.discovery.DiscoveryClient : Getting all instance registry from the eureka server
13:24:31.190 ERROR c.n.d.s.t.d.RedirectingEurekaHttpClient : Request execution error. endpoint=DefaultEndpoint{ serviceUrl='http://localhost:8099/eureka/}

com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused
    at com.sun.jersey.client.apache4.ApacheHttpClient4Handler.handle(ApacheHttpClient4Handler.java:187) ~[jersey-apache-client4-1.19.1.jar:1.19.1]
    ...
    at com.netflix.discovery.EurekaIdentityHeaderFilter.handle(EurekaIdentityHeaderFilter.java:27) ~[eureka-client-1.9.13.jar:1.9.13]
    ...
    at com.netflix.discovery.shared.transport.jersey.AbstractJerseyEurekaHttpClient.getApplications(AbstractJerseyEurekaHttpClient.java:165) ~[eureka-client-1.9.13.jar:1.9.13]
    ...
Caused by: java.net.ConnectException: Connection refused
    at java.base/sun.nio.ch.Net.pollConnect(Native Method) ~[na:na]
    ..
    at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:333) ~[na:na]
    at java.base/java.net.Socket.connect(Socket.java:648) ~[na:na]
    ...

13:24:31.191 c.n.d.s.t.d.RetryableEurekaHttpClient : Request execution failed with message: java.net.ConnectException: Connection refused
13:24:31.193 ERROR com.netflix.discovery.DiscoveryClient : DiscoveryClient_SERVICEDIRECTORY/xxxComputer.fritz.box:ServiceDirectory:8099 - was unable to refresh its cache! status = Cannot execute request on any known server

com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server
    at com.netflix.discovery.shared.transport.decorator.SessionedEurekaHttpClient.execute(SessionedEurekaHttpClient.java:77) ~[eureka-client-1.9.13.jar:1.9.13]
    ...

13:24:31.193 com.netflix.discovery.DiscoveryClient : Using default backup registry implementation which does not do anything.
13:24:31.194 com.netflix.discovery.DiscoveryClient : Starting heartbeat executor: renew interval is: 30
13:24:31.195 c.n.discovery.Instance Replicator : Instance Replicator onDemand update allowed rate per min is 4
13:24:31.197 com.netflix.discovery.DiscoveryClient : Discovery Client initialized at timestamp 1586345071197 with initial instances count: 0
13:24:31.210 c.n.eureka.DefaultEurekaServerContext : Initializing ...
13:24:31.210 c.n.eureka.cluster.PeerEurekaNodes : Adding new peer nodes [http://localhost:8099/eureka/]
...
13:24:31.304 c.n.eureka.cluster.PeerEurekaNodes : Replica node URL: http://localhost:8099/eureka/
13:24:31.308 c.n.e.registry.AbstractInstanceRegistry : Finished initializing remote region registries. All known remote regions: []
13:24:31.310 c.n.eureka.DefaultEurekaServerContext : Initialized
13:24:31.346 o.s.c.n.e.s.EurekaServiceRegistry : Registering application SERVICEDIRECTORY with eureka with status UP
13:24:31.347 com.netflix.discovery.DiscoveryClient : Saw local status change event StatusChangeEvent [timestamp=1586345071347, current=UP, previous=STARTING]
13:24:31.347 com.netflix.discovery.DiscoveryClient : DiscoveryClient_SERVICEDIRECTORY/xxxComputer.fritz.box:ServiceDirectory:8099: registering service...
13:24:31.349 o.s.c.n.e.server.EurekaServerBootstrap : Setting the eureka configuration..
13:24:31.350 d.s.w.p.DocumentationPluginsBootstrapper : Context refreshed
13:24:31.350 o.s.c.n.e.server.EurekaServerBootstrap : Eureka data center value eureka.datacenter is not set, defaulting to default
13:24:31.350 o.s.c.n.e.server.EurekaServerBootstrap : Eureka environment value eureka.environment is not set, defaulting to test
...
13:24:31.351 c.n.d.s.t.d.RedirectingEurekaHttpClient : Request execution error. endpoint=DefaultEndpoint{ serviceUrl='http://localhost:8099/eureka/}

com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused
    at com.sun.jersey.client.apache4.ApacheHttpClient4Handler.handle(ApacheHttpClient4Handler.java:187) ~[jersey-apache-client4-1.19.1.jar:1.19.1]
    ...
    at com.netflix.discovery.EurekaIdentityHeaderFilter.handle(EurekaIdentityHeaderFilter.java:27) ~[eureka-client-1.9.13.jar:1.9.13]
    at com.sun.jersey.api.client.Client.handle(Client.java:652) ~[jersey-client-1.19.1.jar:1.19.1]
    ...
    at com.netflix.discovery.shared.transport.jersey.AbstractJerseyEurekaHttpClient.register(AbstractJerseyEurekaHttpClient.java:56) ~[eureka-client-1.9.13.jar:1.9.13]
    ...
Caused by: java.net.ConnectException: Connection refused
    at java.base/sun.nio.ch.Net.pollConnect(Native Method) ~[na:na]
    ...
    at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:121) ~[httpclient-4.5.12.jar:4.5.12]
    ...

13:24:31.352 c.n.d.s.t.d.RetryableEurekaHttpClient : Request execution failed with message: java.net.ConnectException: Connection refused
13:24:31.353 com.netflix.discovery.DiscoveryClient : DiscoveryClient_SERVICEDIRECTORY/xxxComputer.fritz.box:ServiceDirectory:8099 - registration failed Cannot execute request on any known server

com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server
    at com.netflix.discovery.shared.transport.decorator.RetryableEurekaHttpClient.execute(RetryableEurekaHttpClient.java:112) ~[eureka-client-1.9.13.jar:1.9.13]
    ...

13:24:31.354 c.n.discovery.Instance Replicator : There was a problem with the instance replicator

com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server
    at com.netflix.discovery.shared.transport.decorator.RetryableEurekaHttpClient.execute(RetryableEurekaHttpClient.java:112) ~[eureka-client-1.9.13.jar:1.9.13]
    ...

13:24:31.371 s.d.s.w.s.ApiListingReferenceScanner : Scanning for api listing references
13:24:31.457 o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8099 (http) with context path ''
13:24:31.458 .s.c.n.e.s.EurekaAutoServiceRegistration : Updating port to 8099
...
13:24:34.203 c.n.e.registry.AbstractInstanceRegistry : Registered instance GATEWAY/xxxComputer.fritz.box:gateway:8088 with status UP (replication=false)
...
13:24:34.722 c.n.e.registry.AbstractInstanceRegistry : Registered instance GATEWAY/xxxComputer.fritz.box:gateway:8088 with status UP (replication=true)

Затем он продолжает работать.

Вкл. часть, которая встречается в этом выводе несколько раз, представляет собой следующее ПРЕДУПРЕЖДЕНИЕ:

13:22:23.658 ERROR com.netflix.discovery.DiscoveryClient : DiscoveryClient_SERVICEDIRECTORY/xxxComputer.fritz.box:ServiceDirectory:8099 - ...(more stuff)

Как видно из fritz.box (мой маршрутизатор) в имени хоста, я работаю из дома. Я оставил это в журналах, потому что мне интересно, почему он пытается зарегистрироваться во всей локальной сети, используя мой маршрутизатор. Разве это не должно быть просто использование «localhost»?

На стороне клиента выводится следующее:

Вывод клиента Eureka:


 . ____ _ __ _ _
 /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/ ___)| |_)| | | | | || (_| | ) ) ) )
 ' |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot :: (v2.2.6.RELEASE)

13:24:29.584 com.whatever.ApiGatewayApplication : The following profiles are active: test
...
13:24:32.004 o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8088 (http)
...
13:24:34.122 com.netflix.discovery.DiscoveryClient : Starting heartbeat executor: renew interval is: 30
13:24:34.126 c.n.discovery.Instance Replicator : Instance Replicator onDemand update allowed rate per min is 4
13:24:34.132 com.netflix.discovery.DiscoveryClient : Discovery Client initialized at timestamp 1586345074130 with initial instances count: 0
13:24:34.137 o.s.c.n.e.s.EurekaServiceRegistry : Registering application GATEWAY with eureka with status UP
13:24:34.137 com.netflix.discovery.DiscoveryClient : Saw local status change event StatusChangeEvent [timestamp=1586345074137, current=UP, previous=STARTING]
13:24:34.139 com.netflix.discovery.DiscoveryClient : DiscoveryClient_GATEWAY/xxxComputer.fritz.box:gateway:8088: registering service...
13:24:34.181 o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8088 (http) with context path ''
13:24:34.182 .s.c.n.e.s.EurekaAutoServiceRegistration : Updating port to 8088
13:24:34.186 com.whatever.ApiGatewayApplication : Started ApiGatewayApplication in 5.556 seconds (JVM running for 6.113)
13:24:34.206 com.netflix.discovery.DiscoveryClient : DiscoveryClient_GATEWAY/xxxComputer.fritz.box:gateway:8088 - registration status: 204
...
13:25:04.125 com.netflix.discovery.DiscoveryClient : Getting all instance registry from the eureka server
13:25:04.168 com.netflix.discovery.DiscoveryClient : The response status is 200

Что мне кажется на первый взгляд все в порядке.


Пока я пытался проверить, не возникает ли проблема с различными версиями весеннего облака. Поскольку я использую версию весенней загрузки 2.2.x, в рассмотрение принимаются только релизы весеннего облака Hoxton. Но, возможно, мне следует расширить это предположение.

Я перезапустил свой компьютер.

Я проверил, сохраняется ли проблема при запуске других клиентов.

Одна забавная вещь: Эврика сервер перезагружается, как только я запускаю клиент. Кажется, даже не дождался получения запроса.

Может кто-нибудь помочь мне найти решение этой проблемы?

1 Ответ

0 голосов
/ 20 апреля 2020

Я нашел обходной путь для меня. Кажется, что эта проблема связана с NetBeans, который я использую в версии 11.3 (в настоящее время самая новая).

Когда я использую mvn из командной строки и запускаю службы с java в отдельных терминалах, проблема исчезла.

Я не знаю, почему Netbeans создает эту проблему.

Пока этот обходной путь подходит для меня, поэтому я закрою эту проблему.

...