Spring Cloud Eureka server restarts as soon as eureka client service is started. (After upgrading JDK and Spring Boot version.)

huangapple go评论105阅读模式
英文:

Spring Cloud Eureka server restarts as soon as eureka client service is started. (After upgrading JDK and Spring Boot version.)

问题

I am developing a set of microservices that discover each other using a eureka server.

Yesterday I upgraded our projects from JDK 1.8 to JDK 14 and adapted all version numbers of the dependencies to the most recent ones. I am now using spring-boot-starter-parent as parent POM in version 2.2.6.RELEASE.

All projects are building fine, also all unit tests are running through. However, today I discovered that the service discovery using Eureka doesn't work anymore.

For testing, I usually start my Eureka server first and wait for it to come up completely. Afterwards, I start the clients so they can register with it. The problem is: As soon as I start the first client service, the Eureka server shuts down and attempts to restart, throwing lots of exceptions that weren't there the first time it started.

In the end, when it seems to have settled, I can't call my services, probably because they are not discoverable.


Here are some details about my setup:

I use a custom parent POM derived from spring-boot-starter-parent.

Parent POM:

  1. <!-- ... content ... -->

The POM of my Eureka server service is as follows:

Eureka-Server POM:

  1. <!-- ... content ... -->

One thing worthy to note: My Eureka server service is a Eureka client itself.

This is my application.yml from the Eureka server service:

application.yml of Eureka Server:

  1. <!-- ... content ... -->

As an example for a client application.yml, this is the application.yml of my API-Gateway service, which registers itself with the Eureka server:

application.yml of Eureka Client (API-Gateway):

  1. <!-- ... content ... -->

It doesn't seem to matter which client service I start.

Let me know if you need more details about the setup.

Here is the output of my Eureka server:

Eureka server output 1:

  1. <!-- ... content ... -->

After letting it run for a while, it adds more output like this:

Eureka server output 2:

  1. <!-- ... content ... -->

I can let it run for as long as I want. As soon as I start another service, the following is printed in the Eureka server output:

Eureka server error output:

  1. <!-- ... content ... -->

This is the output it produces by itself, without any other service started.

英文:

I am developing a set of microservices that discover each other using a eureka server.

Yesterday I upgraded our projects from JDK 1.8 to JDK 14 and adapted all version numbers of the dependencies to the most recent ones. I am now using spring-boot-starter-parent as parent POM in version 2.2.6.RELEASE.

All projects are building fine, also all unit tests are running through. However today I discovered that the service discovery using eureka doesn't work anymore.

For testing, I usually start my eureka server at first and wait for it to come up completely. Afterwards I start the clients so they can register to it. The problem is: As soon as I start the first client service, the eureka server shuts down and attempts to restart, throwing lots of exceptions that weren't there the first it started.

In the end, when it seems to have settled, I can't call my services, probably because they are not discoverable.


Here some details about my setup:

I use a custom parent POM, derived from spring-boot-starter-parent.

Parent POM:

  1. &lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot;
  2. xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
  3. xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&gt;
  4. &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  5. &lt;parent&gt;
  6. &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
  7. &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
  8. &lt;version&gt;2.2.6.RELEASE&lt;/version&gt;
  9. &lt;relativePath /&gt;
  10. &lt;/parent&gt;
  11. &lt;groupId&gt;com.whatever&lt;/groupId&gt;
  12. &lt;artifactId&gt;parent&lt;/artifactId&gt;
  13. &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
  14. &lt;packaging&gt;pom&lt;/packaging&gt;
  15. &lt;properties&gt;
  16. &lt;java.version&gt;14&lt;/java.version&gt;
  17. &lt;spring-cloud.version&gt;Hoxton.RELEASE&lt;/spring-cloud.version&gt;
  18. &lt;!-- Also tried these...
  19. &lt;spring-cloud.version&gt;Hoxton.SR1&lt;/spring-cloud.version&gt;
  20. &lt;spring-cloud.version&gt;Hoxton.SR2&lt;/spring-cloud.version&gt;
  21. &lt;spring-cloud.version&gt;Hoxton.SR3&lt;/spring-cloud.version&gt;
  22. --&gt;
  23. &lt;/properties&gt;
  24. &lt;dependencyManagement&gt;
  25. &lt;dependencies&gt;
  26. &lt;dependency&gt;
  27. &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
  28. &lt;artifactId&gt;spring-cloud-starter-parent&lt;/artifactId&gt;
  29. &lt;version&gt;${spring-cloud.version}&lt;/version&gt;
  30. &lt;type&gt;pom&lt;/type&gt;
  31. &lt;scope&gt;import&lt;/scope&gt;
  32. &lt;/dependency&gt;
  33. &lt;/dependencies&gt;
  34. &lt;/dependencyManagement&gt;
  35. &lt;!-- ... more stuff ... --&gt;
  36. &lt;/project&gt;

The POM of my eureka server service is as follows:

Eureka-Server POM:

  1. &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  2. &lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
  3. xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&gt;
  4. &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  5. &lt;parent&gt;
  6. &lt;groupId&gt;com.whatever&lt;/groupId&gt;
  7. &lt;artifactId&gt;parent&lt;/artifactId&gt;
  8. &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
  9. &lt;relativePath/&gt;
  10. &lt;/parent&gt;
  11. &lt;groupId&gt;com.whatever&lt;/groupId&gt;
  12. &lt;artifactId&gt;service-directory&lt;/artifactId&gt;
  13. &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
  14. &lt;properties&gt;
  15. &lt;java.version&gt;14&lt;/java.version&gt;
  16. &lt;/properties&gt;
  17. &lt;dependencies&gt;
  18. &lt;dependency&gt;
  19. &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
  20. &lt;artifactId&gt;spring-cloud-starter-netflix-eureka-server&lt;/artifactId&gt;
  21. &lt;/dependency&gt;
  22. &lt;dependency&gt;
  23. &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
  24. &lt;artifactId&gt;spring-boot-configuration-processor&lt;/artifactId&gt;
  25. &lt;optional&gt;true&lt;/optional&gt;
  26. &lt;/dependency&gt;
  27. &lt;dependency&gt;
  28. &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
  29. &lt;artifactId&gt;spring-boot-devtools&lt;/artifactId&gt;
  30. &lt;scope&gt;runtime&lt;/scope&gt;
  31. &lt;/dependency&gt;
  32. &lt;dependency&gt;
  33. &lt;groupId&gt;org.projectlombok&lt;/groupId&gt;
  34. &lt;artifactId&gt;lombok&lt;/artifactId&gt;
  35. &lt;optional&gt;true&lt;/optional&gt;
  36. &lt;/dependency&gt;
  37. &lt;dependency&gt;
  38. &lt;groupId&gt;io.springfox&lt;/groupId&gt;
  39. &lt;artifactId&gt;springfox-swagger2&lt;/artifactId&gt;
  40. &lt;/dependency&gt;
  41. &lt;dependency&gt;
  42. &lt;groupId&gt;io.springfox&lt;/groupId&gt;
  43. &lt;artifactId&gt;springfox-swagger-ui&lt;/artifactId&gt;
  44. &lt;/dependency&gt;
  45. &lt;dependency&gt;
  46. &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
  47. &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
  48. &lt;scope&gt;test&lt;/scope&gt;
  49. &lt;/dependency&gt;
  50. &lt;/dependencies&gt;
  51. &lt;build&gt;
  52. &lt;plugins&gt;
  53. &lt;plugin&gt;
  54. &lt;groupId&gt;org.jacoco&lt;/groupId&gt;
  55. &lt;artifactId&gt;jacoco-maven-plugin&lt;/artifactId&gt;
  56. &lt;!-- version managed in parent POM --&gt;
  57. &lt;/plugin&gt;
  58. &lt;/plugins&gt;
  59. &lt;/build&gt;
  60. &lt;/project&gt;

One thing worthy to note: My eureka server service is a eureka client itself.

This is my application.yml from the eureka server service:

application.yml of Eureka Server:

  1. spring:
  2. profiles:
  3. active: test
  4. application:
  5. name: ServiceDirectory
  6. server:
  7. port: 8099
  8. logging.level:
  9. org.springframework:
  10. web: DEBUG
  11. web.servlet.view.freemarker.FreeMarkerConfigurer: INFO
  12. eureka:
  13. client:
  14. service-url:
  15. defaultZone: http://localhost:${server.port}/eureka/
  16. management:
  17. endpoint:
  18. health:
  19. show-details: always
  20. endpoints:
  21. web:
  22. exposure:
  23. include:
  24. - &#39;*&#39;
  25. ---
  26. spring:
  27. profiles: test
  28. spring.output.ansi.enabled: ALWAYS

As an example for a client application.yml, this is the application.yml of my API-Gateway service, that registers itself at the eureka server:

application.yml of Eureka Client (API-Gateway):

  1. spring:
  2. profiles:
  3. active: test
  4. application:
  5. name: gateway
  6. server:
  7. port: 8088
  8. eureka:
  9. client:
  10. service-url:
  11. defaultZone: http://localhost:8099/eureka/
  12. ---
  13. spring:
  14. profiles: test
  15. zuul:
  16. routes:
  17. service-a:
  18. path: /service-a/**
  19. url: http://localhost:8083
  20. sensitiveHeaders:
  21. strip-prefix: true
  22. service-b:
  23. path: /service-b/**
  24. url: http://localhost:9920
  25. sensitiveHeaders:
  26. strip-prefix: true
  27. service-directory:
  28. path: /service-directory/**
  29. url: http://localhost:8099
  30. sensitiveHeaders:
  31. strip-prefix: true
  32. eureka-home:
  33. path: /eureka/**
  34. url: http://localhost:8099
  35. sensitiveHeaders:
  36. strip-prefix: false
  37. spring.output.ansi.enabled: ALWAYS

It doesn't seem to matter, which client service I start.

Let me know if you need more details about the setup.

Here is the output of my eureka server:

Eureka server output 1:

  1. . ____ _ __ _ _
  2. /\\ / ___&#39;_ __ _ _(_)_ __ __ _ \ \ \ \
  3. ( ( )\___ | &#39;_ | &#39;_| | &#39;_ \/ _` | \ \ \ \
  4. \\/ ___)| |_)| | | | | || (_| | ) ) ) )
  5. &#39; |____| .__|_| |_|_| |_\__, | / / / /
  6. =========|_|==============|___/=/_/_/_/
  7. :: Spring Boot :: (v2.2.6.RELEASE)
  8. 13:22:18.244 c.w.s.ServiceDirectoryApplication : The following profiles are active: test
  9. 13:22:19.625 o.s.boot.actuate.endpoint.EndpointId : Endpoint ID &#39;service-registry&#39; contains invalid characters, please migrate to a valid format.
  10. ...
  11. 13:22:20.769 c.netflix.config.DynamicPropertyFactory : DynamicPropertyFactory is initialized with configuration sources: com.netflix.config.ConcurrentCompositeConfiguration@235cb2ea
  12. WARNING: An illegal reflective access operation has occurred
  13. 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)
  14. WARNING: Please consider reporting this to the maintainers of org.springframework.cglib.core.ReflectUtils
  15. WARNING: Use --illegal-access= to enable ings of further illegal reflective access operations
  16. WARNING: All illegal access operations will be denied in a future release
  17. 13:22:21.412 c.s.j.s.i.a.WebApplicationImpl : Initiating Jersey application, version &#39;Jersey: 1.19.1 03/11/2016 02:08 PM&#39;
  18. ...
  19. 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.
  20. 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.
  21. 13:22:23.254 o.s.c.n.eureka.Instance Factory : Setting initial instance status as: STARTING
  22. 13:22:23.321 com.netflix.discovery.DiscoveryClient : Initializing Eureka in region us-east-1
  23. ...
  24. 13:22:23.601 com.netflix.discovery.DiscoveryClient : Getting all instance registry from the eureka server
  25. 13:22:23.655 ERROR c.n.d.s.t.d.RedirectingEurekaHttpClient : Request execution error. endpoint=DefaultEndpoint{ serviceUrl=&#39;http://localhost:8099/eureka/}
  26. com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused
  27. at com.sun.jersey.client.apache4.ApacheHttpClient4Handler.handle(ApacheHttpClient4Handler.java:187) ~[jersey-apache-client4-1.19.1.jar:1.19.1]
  28. ...
  29. at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator$6.execute(EurekaHttpClientDecorator.java:137) ~[eureka-client-1.9.13.jar:1.9.13]
  30. ...
  31. Caused by: java.net.ConnectException: Connection refused
  32. at java.base/sun.nio.ch.Net.pollConnect(Native Method) ~[na:na]
  33. ...
  34. at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:180) ~[httpclient-4.5.12.jar:4.5.12]
  35. ...
  36. 13:22:23.656 c.n.d.s.t.d.RetryableEurekaHttpClient : Request execution failed with message: java.net.ConnectException: Connection refused
  37. 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
  38. com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server
  39. at com.netflix.discovery.shared.transport.decorator.RetryableEurekaHttpClient.execute(RetryableEurekaHttpClient.java:112) ~[eureka-client-1.9.13.jar:1.9.13]
  40. ...
  41. 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]
  42. ...
  43. at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) ~[spring-boot-devtools-2.2.6.RELEASE.jar:2.2.6.RELEASE]
  44. 13:22:23.659 com.netflix.discovery.DiscoveryClient : Using default backup registry implementation which does not do anything.
  45. ...
  46. 13:22:23.691 c.n.eureka.cluster.PeerEurekaNodes : Adding new peer nodes [http://localhost:8099/eureka/]
  47. ...
  48. 13:22:23.805 c.n.eureka.cluster.PeerEurekaNodes : Replica node URL: http://localhost:8099/eureka/
  49. 13:22:23.810 c.n.e.registry.AbstractInstanceRegistry : Finished initializing remote region registries. All known remote regions: []
  50. 13:22:23.811 c.n.eureka.DefaultEurekaServerContext : Initialized
  51. 13:22:23.854 o.s.c.n.e.s.EurekaServiceRegistry : Registering application SERVICEDIRECTORY with eureka with status UP
  52. 13:22:23.855 com.netflix.discovery.DiscoveryClient : Saw local status change event StatusChangeEvent [timestamp=1586344943855, current=UP, previous=STARTING]
  53. 13:22:23.857 com.netflix.discovery.DiscoveryClient : DiscoveryClient_SERVICEDIRECTORY/xxxComputer.fritz.box:ServiceDirectory:8099: registering service...
  54. 13:22:23.860 o.s.c.n.e.server.EurekaServerBootstrap : Setting the eureka configuration..
  55. 13:22:23.860 d.s.w.p.DocumentationPluginsBootstrapper : Context refreshed
  56. 13:22:23.860 o.s.c.n.e.server.EurekaServerBootstrap : Eureka data center value eureka.datacenter is not set, defaulting to default
  57. 13:22:23.861 o.s.c.n.e.server.EurekaServerBootstrap : Eureka environment value eureka.environment is not set, defaulting to test
  58. 13:22:23.863 c.n.d.s.t.d.RedirectingEurekaHttpClient : Request execution error. endpoint=DefaultEndpoint{ serviceUrl=&#39;http://localhost:8099/eureka/}
  59. com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused
  60. ...
  61. at com.netflix.discovery.EurekaIdentityHeaderFilter.handle(EurekaIdentityHeaderFilter.java:27) ~[eureka-client-1.9.13.jar:1.9.13]
  62. at com.sun.jersey.api.client.Client.handle(Client.java:652) ~[jersey-client-1.19.1.jar:1.19.1]
  63. ...
  64. at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.register(EurekaHttpClientDecorator.java:56) ~[eureka-client-1.9.13.jar:1.9.13]
  65. ...
  66. Caused by: java.net.ConnectException: Connection refused
  67. ...
  68. ...
  69. 13:22:23.864 c.n.d.s.t.d.RetryableEurekaHttpClient : Request execution failed with message: java.net.ConnectException: Connection refused
  70. 13:22:23.869 com.netflix.discovery.DiscoveryClient : DiscoveryClient_SERVICEDIRECTORY/xxxComputer.fritz.box:ServiceDirectory:8099 - registration failed Cannot execute request on any known server
  71. com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server
  72. at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator$1.execute(EurekaHttpClientDecorator.java:59) ~[eureka-client-1.9.13.jar:1.9.13]
  73. ...
  74. 13:22:23.870 c.n.discovery.Instance Replicator : There was a problem with the instance replicator
  75. com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server
  76. at com.netflix.discovery.shared.transport.decorator.RetryableEurekaHttpClient.execute(RetryableEurekaHttpClient.java:112) ~[eureka-client-1.9.13.jar:1.9.13]
  77. ...
  78. ...
  79. 13:22:24.193 o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8099 (http) with context path &#39;&#39;
  80. 13:22:24.194 .s.c.n.e.s.EurekaAutoServiceRegistration : Updating port to 8099
  81. 13:22:24.197 c.w.s.ServiceDirectoryApplication : Started ServiceDirectoryApplication in 6.846 seconds (JVM running for 7.369)

This is the output it produces by itself, without any other service started.

After letting it run for a while, it adds more output like this:

Eureka server output 2:

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

I can let it run for as long as I want. As soon as I start another service, the following is printed in the eureka server output:

Eureka server error output:

  1. 13:24:25.899 o.s.c.n.e.s.EurekaServiceRegistry : Unregistering application SERVICEDIRECTORY with eureka with status DOWN
  2. 13:24:25.899 com.netflix.discovery.DiscoveryClient : Saw local status change event StatusChangeEvent [timestamp=1586345065899, current=DOWN, previous=UP]
  3. 13:24:25.900 com.netflix.discovery.DiscoveryClient : DiscoveryClient_SERVICEDIRECTORY/xxxComputer.fritz.box:ServiceDirectory:8099: registering service...
  4. 13:24:25.903 c.n.eureka.DefaultEurekaServerContext : Shutting down ...
  5. 13:24:25.907 o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped to ResourceHttpRequestHandler [&quot;classpath:/META-INF/resources/&quot;, &quot;classpath:/resources/&quot;, &quot;classpath:/static/&quot;, &quot;classpath:/public/&quot;, &quot;/&quot;]
  6. 13:24:25.908 c.n.eureka.DefaultEurekaServerContext : Shut down
  7. 13:24:25.910 c.n.e.registry.AbstractInstanceRegistry : Registered instance SERVICEDIRECTORY/xxxComputer.fritz.box:ServiceDirectory:8099 with status DOWN (replication=false)
  8. 13:24:25.911 o.s.b.f.support.DisposableBeanAdapter : Invocation of destroy method failed on bean with name &#39;tomcatMetricsBinder&#39;: java.lang.NoSuchMethodError: &#39;void io.micrometer.core.instrument.binder.tomcat.TomcatMetrics.close()&#39;
  9. 13:24:25.912 com.netflix.discovery.DiscoveryClient : DiscoveryClient_SERVICEDIRECTORY/xxxComputer.fritz.box:ServiceDirectory:8099 - registration status: 204
  10. 13:24:25.913 o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService &#39;applicationTaskExecutor&#39;
  11. 13:24:25.923 com.netflix.discovery.DiscoveryClient : Shutting down DiscoveryClient ...
  12. 13:24:28.924 com.netflix.discovery.DiscoveryClient : Unregistering ...
  13. 13:24:28.930 o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped to ResourceHttpRequestHandler [&quot;classpath:/META-INF/resources/&quot;, &quot;classpath:/resources/&quot;, &quot;classpath:/static/&quot;, &quot;classpath:/public/&quot;, &quot;/&quot;]
  14. 13:24:28.933 c.n.e.registry.AbstractInstanceRegistry : Cancelled instance SERVICEDIRECTORY/xxxComputer.fritz.box:ServiceDirectory:8099 (replication=false)
  15. 13:24:28.935 com.netflix.discovery.DiscoveryClient : DiscoveryClient_SERVICEDIRECTORY/xxxComputer.fritz.box:ServiceDirectory:8099 - deregister status: 200
  16. 13:24:28.953 com.netflix.discovery.DiscoveryClient : Completed shut down of DiscoveryClient
  17. 13:24:29.111 trationDelegate$BeanPostProcessorChecker : Bean &#39;org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration&#39; of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
  18. . ____ _ __ _ _
  19. /\\ / ___&#39;_ __ _ _(_)_ __ __ _ \ \ \ \
  20. ( ( )\___ | &#39;_ | &#39;_| | &#39;_ \/ _` | \ \ \ \
  21. \\/ ___)| |_)| | | | | || (_| | ) ) ) )
  22. &#39; |____| .__|_| |_|_| |_\__, | / / / /
  23. =========|_|==============|___/=/_/_/_/
  24. :: Spring Boot :: (v2.2.6.RELEASE)
  25. 13:24:29.170 c.w.s.ServiceDirectoryApplication : The following profiles are active: test
  26. ...
  27. 13:24:31.186 com.netflix.discovery.DiscoveryClient : Getting all instance registry from the eureka server
  28. 13:24:31.190 ERROR c.n.d.s.t.d.RedirectingEurekaHttpClient : Request execution error. endpoint=DefaultEndpoint{ serviceUrl=&#39;http://localhost:8099/eureka/}
  29. com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused
  30. at com.sun.jersey.client.apache4.ApacheHttpClient4Handler.handle(ApacheHttpClient4Handler.java:187) ~[jersey-apache-client4-1.19.1.jar:1.19.1]
  31. ...
  32. at com.netflix.discovery.EurekaIdentityHeaderFilter.handle(EurekaIdentityHeaderFilter.java:27) ~[eureka-client-1.9.13.jar:1.9.13]
  33. ...
  34. at com.netflix.discovery.shared.transport.jersey.AbstractJerseyEurekaHttpClient.getApplications(AbstractJerseyEurekaHttpClient.java:165) ~[eureka-client-1.9.13.jar:1.9.13]
  35. ...
  36. Caused by: java.net.ConnectException: Connection refused
  37. at java.base/sun.nio.ch.Net.pollConnect(Native Method) ~[na:na]
  38. ..
  39. at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:333) ~[na:na]
  40. at java.base/java.net.Socket.connect(Socket.java:648) ~[na:na]
  41. ...
  42. 13:24:31.191 c.n.d.s.t.d.RetryableEurekaHttpClient : Request execution failed with message: java.net.ConnectException: Connection refused
  43. 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
  44. com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server
  45. at com.netflix.discovery.shared.transport.decorator.SessionedEurekaHttpClient.execute(SessionedEurekaHttpClient.java:77) ~[eureka-client-1.9.13.jar:1.9.13]
  46. ...
  47. 13:24:31.193 com.netflix.discovery.DiscoveryClient : Using default backup registry implementation which does not do anything.
  48. 13:24:31.194 com.netflix.discovery.DiscoveryClient : Starting heartbeat executor: renew interval is: 30
  49. 13:24:31.195 c.n.discovery.Instance Replicator : Instance Replicator onDemand update allowed rate per min is 4
  50. 13:24:31.197 com.netflix.discovery.DiscoveryClient : Discovery Client initialized at timestamp 1586345071197 with initial instances count: 0
  51. 13:24:31.210 c.n.eureka.DefaultEurekaServerContext : Initializing ...
  52. 13:24:31.210 c.n.eureka.cluster.PeerEurekaNodes : Adding new peer nodes [http://localhost:8099/eureka/]
  53. ...
  54. 13:24:31.304 c.n.eureka.cluster.PeerEurekaNodes : Replica node URL: http://localhost:8099/eureka/
  55. 13:24:31.308 c.n.e.registry.AbstractInstanceRegistry : Finished initializing remote region registries. All known remote regions: []
  56. 13:24:31.310 c.n.eureka.DefaultEurekaServerContext : Initialized
  57. 13:24:31.346 o.s.c.n.e.s.EurekaServiceRegistry : Registering application SERVICEDIRECTORY with eureka with status UP
  58. 13:24:31.347 com.netflix.discovery.DiscoveryClient : Saw local status change event StatusChangeEvent [timestamp=1586345071347, current=UP, previous=STARTING]
  59. 13:24:31.347 com.netflix.discovery.DiscoveryClient : DiscoveryClient_SERVICEDIRECTORY/xxxComputer.fritz.box:ServiceDirectory:8099: registering service...
  60. 13:24:31.349 o.s.c.n.e.server.EurekaServerBootstrap : Setting the eureka configuration..
  61. 13:24:31.350 d.s.w.p.DocumentationPluginsBootstrapper : Context refreshed
  62. 13:24:31.350 o.s.c.n.e.server.EurekaServerBootstrap : Eureka data center value eureka.datacenter is not set, defaulting to default
  63. 13:24:31.350 o.s.c.n.e.server.EurekaServerBootstrap : Eureka environment value eureka.environment is not set, defaulting to test
  64. ...
  65. 13:24:31.351 c.n.d.s.t.d.RedirectingEurekaHttpClient : Request execution error. endpoint=DefaultEndpoint{ serviceUrl=&#39;http://localhost:8099/eureka/}
  66. com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused
  67. at com.sun.jersey.client.apache4.ApacheHttpClient4Handler.handle(ApacheHttpClient4Handler.java:187) ~[jersey-apache-client4-1.19.1.jar:1.19.1]
  68. ...
  69. at com.netflix.discovery.EurekaIdentityHeaderFilter.handle(EurekaIdentityHeaderFilter.java:27) ~[eureka-client-1.9.13.jar:1.9.13]
  70. at com.sun.jersey.api.client.Client.handle(Client.java:652) ~[jersey-client-1.19.1.jar:1.19.1]
  71. ...
  72. at com.netflix.discovery.shared.transport.jersey.AbstractJerseyEurekaHttpClient.register(AbstractJerseyEurekaHttpClient.java:56) ~[eureka-client-1.9.13.jar:1.9.13]
  73. ...
  74. Caused by: java.net.ConnectException: Connection refused
  75. at java.base/sun.nio.ch.Net.pollConnect(Native Method) ~[na:na]
  76. ...
  77. at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:121) ~[httpclient-4.5.12.jar:4.5.12]
  78. ...
  79. 13:24:31.352 c.n.d.s.t.d.RetryableEurekaHttpClient : Request execution failed with message: java.net.ConnectException: Connection refused
  80. 13:24:31.353 com.netflix.discovery.DiscoveryClient : DiscoveryClient_SERVICEDIRECTORY/xxxComputer.fritz.box:ServiceDirectory:8099 - registration failed Cannot execute request on any known server
  81. com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server
  82. at com.netflix.discovery.shared.transport.decorator.RetryableEurekaHttpClient.execute(RetryableEurekaHttpClient.java:112) ~[eureka-client-1.9.13.jar:1.9.13]
  83. ...
  84. 13:24:31.354 c.n.discovery.Instance Replicator : There was a problem with the instance replicator
  85. com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server
  86. at com.netflix.discovery.shared.transport.decorator.RetryableEurekaHttpClient.execute(RetryableEurekaHttpClient.java:112) ~[eureka-client-1.9.13.jar:1.9.13]
  87. ...
  88. 13:24:31.371 s.d.s.w.s.ApiListingReferenceScanner : Scanning for api listing references
  89. 13:24:31.457 o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8099 (http) with context path &#39;&#39;
  90. 13:24:31.458 .s.c.n.e.s.EurekaAutoServiceRegistration : Updating port to 8099
  91. ...
  92. 13:24:34.203 c.n.e.registry.AbstractInstanceRegistry : Registered instance GATEWAY/xxxComputer.fritz.box:gateway:8088 with status UP (replication=false)
  93. ...
  94. 13:24:34.722 c.n.e.registry.AbstractInstanceRegistry : Registered instance GATEWAY/xxxComputer.fritz.box:gateway:8088 with status UP (replication=true)

Then it keeps running.

On part that occurs multiple times in this output is the followWARNING:

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

As you can see from the fritz.box (my router) in the hostname, I work from home. I left it inside the logs because I wonder why it is trying to register itself within the whole LAN using my router. Shouldn't it be simply using "localhost"?

On the client side, the following is printed:

Eureka client output:

  1. . ____ _ __ _ _
  2. /\\ / ___&#39;_ __ _ _(_)_ __ __ _ \ \ \ \
  3. ( ( )\___ | &#39;_ | &#39;_| | &#39;_ \/ _` | \ \ \ \
  4. \\/ ___)| |_)| | | | | || (_| | ) ) ) )
  5. &#39; |____| .__|_| |_|_| |_\__, | / / / /
  6. =========|_|==============|___/=/_/_/_/
  7. :: Spring Boot :: (v2.2.6.RELEASE)
  8. 13:24:29.584 com.whatever.ApiGatewayApplication : The following profiles are active: test
  9. ...
  10. 13:24:32.004 o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8088 (http)
  11. ...
  12. 13:24:34.122 com.netflix.discovery.DiscoveryClient : Starting heartbeat executor: renew interval is: 30
  13. 13:24:34.126 c.n.discovery.Instance Replicator : Instance Replicator onDemand update allowed rate per min is 4
  14. 13:24:34.132 com.netflix.discovery.DiscoveryClient : Discovery Client initialized at timestamp 1586345074130 with initial instances count: 0
  15. 13:24:34.137 o.s.c.n.e.s.EurekaServiceRegistry : Registering application GATEWAY with eureka with status UP
  16. 13:24:34.137 com.netflix.discovery.DiscoveryClient : Saw local status change event StatusChangeEvent [timestamp=1586345074137, current=UP, previous=STARTING]
  17. 13:24:34.139 com.netflix.discovery.DiscoveryClient : DiscoveryClient_GATEWAY/xxxComputer.fritz.box:gateway:8088: registering service...
  18. 13:24:34.181 o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8088 (http) with context path &#39;&#39;
  19. 13:24:34.182 .s.c.n.e.s.EurekaAutoServiceRegistration : Updating port to 8088
  20. 13:24:34.186 com.whatever.ApiGatewayApplication : Started ApiGatewayApplication in 5.556 seconds (JVM running for 6.113)
  21. 13:24:34.206 com.netflix.discovery.DiscoveryClient : DiscoveryClient_GATEWAY/xxxComputer.fritz.box:gateway:8088 - registration status: 204
  22. ...
  23. 13:25:04.125 com.netflix.discovery.DiscoveryClient : Getting all instance registry from the eureka server
  24. 13:25:04.168 com.netflix.discovery.DiscoveryClient : The response status is 200

Which seems to me ok on the first glance.


What I tried so far is to test if the problem occurs with different versions of spring cloud. As I'm using the 2.2.x release of spring boot, only the Hoxton releases of spring cloud come into consideration. But maybe I should broaden that assumption.

I restarted my computer.

I tested if the problem persists with different clients being started.

One funny thing is: The eureka server restarts as soon as I start a client. It doesn't even seem wait for a request to be received.

Can anyone help me to find the solution to this problem?

答案1

得分: 0

我找到了一个适合我的解决方法。看起来这个问题与我使用的Netbeans版本11.3(目前最新版本)有关。

当我在命令行中使用mvn,并在单独的终端中使用java启动服务时,问题就消失了。

我不知道为什么Netbeans会产生这个问题。

目前这个解决方法对我来说还可以,所以我会关闭这个问题。

英文:

I found a workaround for me. It seems like this issue is connected to Netbeans, which I use in version 11.3 (currently the newest).

When I use mvn from the command line and start the services with java in seperate terminals, the problem is gone.

I don't know why Netbeans produces this issue.

For now this workaround is ok for me, so I will close this issue.

huangapple
  • 本文由 发表于 2020年4月8日 20:51:49
  • 转载请务必保留本文链接:https://go.coder-hub.com/61101125.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定