java - Microservice Discovery-server initalization problem - Stack Overflow

I set the application.yml files for configuration server and discovery server. When I start to run conf

I set the application.yml files for configuration server and discovery server. When I start to run config-server, it is started with any error. However, discovery server does not do. It gives some errors such as

  1. Timer already cancelled.

  2. The port is already used. I am sure that the port which used for the discovery server is not used. It is used for just it but it gives the error.

2025-03-12T22:48:08.386+03:00 ERROR 15092 --- [discovery-service] [       Thread-9] o.s.c.n.e.server.EurekaServerBootstrap   : Cannot bootstrap eureka server :

java.lang.IllegalStateException: Timer already cancelled.
    at java.base/java.util.Timer.sched(Timer.java:408) ~[na:na]
    at java.base/java.util.Timer.schedule(Timer.java:259) ~[na:na]
    at comflix.eureka.registry.AbstractInstanceRegistry.postInit(AbstractInstanceRegistry.java:1226) ~[eureka-core-2.0.4.jar:2.0.4]
    at comflix.eureka.registry.PeerAwareInstanceRegistryImpl.openForTraffic(PeerAwareInstanceRegistryImpl.java:259) ~[eureka-core-2.0.4.jar:2.0.4]
    at .springframework.cloudflix.eureka.server.InstanceRegistry.openForTraffic(InstanceRegistry.java:77) ~[spring-cloud-netflix-eureka-server-4.2.0.jar:4.2.0]
    at .springframework.cloudflix.eureka.server.EurekaServerBootstrap.initEurekaServerContext(EurekaServerBootstrap.java:112) ~[spring-cloud-netflix-eureka-server-4.2.0.jar:4.2.0]
    at .springframework.cloudflix.eureka.server.EurekaServerBootstrap.contextInitialized(EurekaServerBootstrap.java:70) ~[spring-cloud-netflix-eureka-server-4.2.0.jar:4.2.0]
    at .springframework.cloudflix.eureka.server.EurekaServerInitializerConfiguration.lambda$start$0(EurekaServerInitializerConfiguration.java:67) ~[spring-cloud-netflix-eureka-server-4.2.0.jar:4.2.0]
    at java.base/java.lang.Thread.run(Thread.java:1575) ~[na:na]

2025-03-12T22:48:08.398+03:00 ERROR 15092 --- [discovery-service] [       Thread-9] e.s.EurekaServerInitializerConfiguration : Could not initialize Eureka servlet context

java.lang.RuntimeException: Cannot bootstrap eureka server :
    at .springframework.cloudflix.eureka.server.EurekaServerBootstrap.contextInitialized(EurekaServerBootstrap.java:76) ~[spring-cloud-netflix-eureka-server-4.2.0.jar:4.2.0]
    at .springframework.cloudflix.eureka.server.EurekaServerInitializerConfiguration.lambda$start$0(EurekaServerInitializerConfiguration.java:67) ~[spring-cloud-netflix-eureka-server-4.2.0.jar:4.2.0]
    at java.base/java.lang.Thread.run(Thread.java:1575) ~[na:na]
Caused by: java.lang.IllegalStateException: Timer already cancelled.
    at java.base/java.util.Timer.sched(Timer.java:408) ~[na:na]
    at java.base/java.util.Timer.schedule(Timer.java:259) ~[na:na]
    at comflix.eureka.registry.AbstractInstanceRegistry.postInit(AbstractInstanceRegistry.java:1226) ~[eureka-core-2.0.4.jar:2.0.4]
    at comflix.eureka.registry.PeerAwareInstanceRegistryImpl.openForTraffic(PeerAwareInstanceRegistryImpl.java:259) ~[eureka-core-2.0.4.jar:2.0.4]
    at .springframework.cloudflix.eureka.server.InstanceRegistry.openForTraffic(InstanceRegistry.java:77) ~[spring-cloud-netflix-eureka-server-4.2.0.jar:4.2.0]
    at .springframework.cloudflix.eureka.server.EurekaServerBootstrap.initEurekaServerContext(EurekaServerBootstrap.java:112) ~[spring-cloud-netflix-eureka-server-4.2.0.jar:4.2.0]
    at .springframework.cloudflix.eureka.server.EurekaServerBootstrap.contextInitialized(EurekaServerBootstrap.java:70) ~[spring-cloud-netflix-eureka-server-4.2.0.jar:4.2.0]
    ... 2 common frames omitted

2025-03-12T22:48:08.417+03:00  INFO 15092 --- [discovery-service] [           main] .s.b.a.l.ConditionEvaluationReportLogger : 

Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
2025-03-12T22:48:08.437+03:00 ERROR 15092 --- [discovery-service] [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

Web server failed to start. Port 8761 was already in use.

Action:

Identify and stop the process that's listening on port 8761 or configure this application to listen on another port.


// application.yml for config and 
server:
  port: 8888
spring:
  profiles:
    active: native
  application:
    name: config-server
  cloud:
    config:
      server:
        native:
          search-locations: classpath:/configurations

//discovery-service.yml for configurations
eureka:
  instance:
    hostname: localhost
  client:
    register-with-eureka: false
    fetch-registry: false
    serviceUrl:
      defaultZone: http://${eureka.instance.hostname}/${server.port}/eureka/

server:
  port: 8761
  enable-self-preservation: false

// application.yml of discovery-server
spring:
  config:
    import: optional:configserver:http://localhost:8888
  application:
    name: discovery-service

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744732308a4590539.html

相关推荐

  • java - Microservice Discovery-server initalization problem - Stack Overflow

    I set the application.yml files for configuration server and discovery server. When I start to run conf

    3天前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信