尝试使用 docker-compose 将发现服务器连接到配置服务器时出错

问题描述 投票:0回答:1

我已经创建了 Discovery Server 和 Config Server 微服务,并且正在尝试获取 Config 中的 Discovery Server 属性。

我正在尝试对这两个服务进行 dockerize,并为此创建了一个 docker-compose.yml,但是当我运行容器时,Eureka Server 抛出“连接被拒绝”异常。配置服务器正常启动,但是eureka服务器抛出异常。

当我通过 IDE 运行这两个服务时,它们可以正常工作,但不能通过 docker-compose 运行。

有谁知道问题出在哪里吗?

application.yaml(配置服务器)

server:
  port: 8888
  
spring:
  application:
    name: config-server
  cloud:
    config:
      server:
        git:
          uri: https://github.com/GustavoSC1/Event-Management-Config-Files-Test
          default-label: main
          search-paths:
          - 'config*' 

application.yaml(发现服务器)

spring:
  application:
    name: discovery-server
  config:
    import: optional:configserver:http://config-server:8888

Dockerfile 示例

FROM openjdk:17-jdk-slim
ARG JAR_FILE=discovery-server/target/*.jar
COPY ${JAR_FILE} app.jar
RUN bash -c 'touch /app.jar'
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]

docker-compose.yml

version: '3.8'

services:   
  rabbitmq:
    image: rabbitmq:3.12.0-management
    container_name: rabbitmq
    restart: always
    ports:
      - 5672:5672
      - 15672:15672
    volumes:
      - ../dados:/var/lib/rabbitmq/
    environment:
      - RABBITMQ_DEFAULT_USER=user
      - RABBITMQ_DEFAULT_PASS=password
    networks:
      - microservices-network
      
  zipkin:
    image: openzipkin/zipkin:3.0.6
    container_name: zipkin
    ports:
      - 9411:9411
    restart: always
    depends_on:
      - rabbitmq
    environment:
      RABBIT_URI: amqp://user:password@rabbitmq:5672
    networks:
      - microservices-network

config-server:
    image: gustavosc1/config-server
    container_name: config-server
    restart: always
    build:
      context: .
      dockerfile: config-server/Dockerfile
    ports:
      - 8888:8888
    networks:
      - microservices-network
      
  discovery-server:
    image: gustavosc1/discovery-server
    container_name: discovery-server
    restart: always
    build:
      context: .
      dockerfile: discovery-server/Dockerfile
    ports:
      - 8761:8761
    environment:
      SPRING.ZIPKIN.BASEURL: http://zipkin:9411/
      MANAGEMENT.ZIPKIN.TRACING.ENDPOINT: http://zipkin:9411/api/v2/spans
      RABBIT_URI: amqp://user:password@rabbitmq:5672
      SPRING_RABBITMQ_HOST: rabbitmq
      SPRING_ZIPKIN_SENDER_TYPE: rabbit
    depends_on:
      config-server:
        condition: service_started
      rabbitmq:
        condition: service_started
    networks:
      - microservices-network

networks:
  microservices-network:
    driver: bridge

命名服务器日志

    2024-03-19T21:18:19.042Z  INFO 1 --- [main] c.g.d.DiscoveryServerApplication: Starting DiscoveryServerApplication v0.0.1-SNAPSHOT using Java 17.0.2 with PID 1 (/app.jar started by root in /)
2024-03-19T21:18:19.047Z  INFO 1 --- [main] c.g.d.DiscoveryServerApplication: 
No active profile set, falling back to 1 default profile: "default"
    2024-03-19T21:18:19.233Z  INFO 1 --- [main] o.s.c.c.c.ConfigServerConfigDataLoader: 
Fetching config from server at : http://config-server:8888
    2024-03-19T21:18:19.234Z  INFO 1 --- [main] o.s.c.c.c.ConfigServerConfigDataLoader: 
Exception on Url - http://config-server:8888:org.springframework.web.client.ResourceAccessException: I/O error on GET request for "http://config-server:8888/discovery-server/default": Connection refused. Will be trying the next url if available
    2024-03-19T21:18:19.234Z  WARN 1 --- [main] o.s.c.c.c.ConfigServerConfigDataLoader: 
Could not locate PropertySource ([ConfigServerConfigDataResource@6f1de4c7 uris = array<String>['http://config-server:8888'], optional = true, profiles = 'default']): I/O error on GET request for "http://config-server:8888/discovery-server/default": Connection refused
    2024-03-19T21:18:19.234Z  INFO 1 --- [main] o.s.c.c.c.ConfigServerConfigDataLoader: 
Fetching config from server at : http://config-server:8888
    2024-03-19T21:18:19.234Z  INFO 1 --- [main] o.s.c.c.c.ConfigServerConfigDataLoader: 
Exception on Url - http://config-server:8888:org.springframework.web.client.ResourceAccessException: I/O error on GET request for "http://config-server:8888/discovery-server/default": Connection refused. Will be trying the next url if available
    2024-03-19T21:18:19.235Z  WARN 1 --- [main] o.s.c.c.c.ConfigServerConfigDataLoader: 
Could not locate PropertySource ([ConfigServerConfigDataResource@55182842 uris = array<String>['http://config-server:8888'], optional = true, profiles = 'default']): I/O error on GET request for "http://config-server:8888/discovery-server/default": Connection refused
    2024-03-19T21:18:19.235Z  INFO 1 --- [main] o.s.c.c.c.ConfigServerConfigDataLoader: 
Fetching config from server at : http://config-server:8888
    2024-03-19T21:18:19.235Z  INFO 1 --- [main] o.s.c.c.c.ConfigServerConfigDataLoader: 
Exception on Url - http://config-server:8888:org.springframework.web.client.ResourceAccessException: I/O error on GET request for "http://config-server:8888/discovery-server/default": Connection refused. Will be trying the next url if available
    2024-03-19T21:18:19.235Z  WARN 1 --- [main] o.s.c.c.c.ConfigServerConfigDataLoader: 
Could not locate PropertySource ([ConfigServerConfigDataResource@3270d194 uris = array<String>['http://config-server:8888'], optional = true, profiles = 'default']): I/O error on GET request for "http://config-server:8888/discovery-server/default": Connection refused
    2024-03-19T21:18:24.408Z  INFO 1 --- [main] o.s.cloud.context.scope.GenericScope: BeanFactory id=6b5919a6-3e46-31f6-a94c-c0261c3e21bc
    2024-03-19T21:18:25.183Z  INFO 1 --- [main] o.s.b.w.embedded.tomcat.TomcatWebServer: Tomcat initialized with port(s): 8080 (http)
    2024-03-19T21:18:25.225Z  INFO 1 --- [main] o.apache.catalina.core.StandardService: Starting service [Tomcat]
    2024-03-19T21:18:25.225Z  INFO 1 --- [main] o.apache.catalina.core.StandardEngine: Starting Servlet engine: [Apache Tomcat/10.1.17]
    2024-03-19T21:18:25.606Z  INFO 1 --- [main] o.a.c.c.C.[Tomcat].[localhost].[/]: Initializing Spring embedded WebApplicationContext
    2024-03-19T21:18:25.609Z  INFO 1 --- [main] w.s.c.ServletWebServerApplicationContext: Root WebApplicationContext: initialization completed in 6367 ms
    2024-03-19T21:18:32.739Z  INFO 1 --- [main] c.n.d.provider.DiscoveryJerseyProvider: Using JSON encoding codec LegacyJacksonJson
    2024-03-19T21:18:32.743Z  INFO 1 --- [main] c.n.d.provider.DiscoveryJerseyProvider: Using JSON decoding codec LegacyJacksonJson
    2024-03-19T21:18:33.598Z  INFO 1 --- [main] c.n.d.provider.DiscoveryJerseyProvider: Using XML encoding codec XStreamXml
    2024-03-19T21:18:33.599Z  INFO 1 --- [main] c.n.d.provider.DiscoveryJerseyProvider: Using XML decoding codec XStreamXml
    2024-03-19T21:18:36.009Z  WARN 1 --- [main] iguration$LoadBalancerCaffeineWarnLogger: Spring Cloud LoadBalancer is currently working with the default cache. While this cache implementation is useful for development and tests, it's recommended to use Caffeine cache in production.You can switch to using Caffeine cache, by adding it and org.springframework.cache.caffeine.CaffeineCacheManager to the classpath.
    2024-03-19T21:18:36.097Z  INFO 1 --- [main] o.s.c.n.eureka.InstanceInfoFactory: Setting initial instance status as: STARTING
    2024-03-19T21:18:36.373Z  INFO 1 --- [main] com.netflix.discovery.DiscoveryClient: Initializing Eureka in region us-east-1
    2024-03-19T21:18:36.474Z  INFO 1 --- [main] c.n.d.provider.DiscoveryJerseyProvider: Using JSON encoding codec LegacyJacksonJson
    2024-03-19T21:18:36.474Z  INFO 1 --- [main] c.n.d.provider.DiscoveryJerseyProvider: Using JSON decoding codec LegacyJacksonJson
    2024-03-19T21:18:36.474Z  INFO 1 --- [main] c.n.d.provider.DiscoveryJerseyProvider: Using XML encoding codec XStreamXml
    2024-03-19T21:18:36.474Z  INFO 1 --- [main] c.n.d.provider.DiscoveryJerseyProvider: Using XML decoding codec XStreamXml
    2024-03-19T21:18:36.786Z  INFO 1 --- [main] c.n.d.s.r.aws.ConfigClusterResolver: Resolving eureka endpoints via configuration
    2024-03-19T21:18:36.874Z  INFO 1 --- [main] com.netflix.discovery.DiscoveryClient: Disable delta property : false
    2024-03-19T21:18:36.874Z  INFO 1 --- [main] com.netflix.discovery.DiscoveryClient: Single vip registry refresh property : null
    2024-03-19T21:18:36.875Z  INFO 1 --- [main] com.netflix.discovery.DiscoveryClient: Force full registry fetch : false
    2024-03-19T21:18:36.875Z  INFO 1 --- [main] com.netflix.discovery.DiscoveryClient: Application is null : false
    2024-03-19T21:18:36.875Z  INFO 1 --- [main] com.netflix.discovery.DiscoveryClient: Registered Applications size is zero : true
    2024-03-19T21:18:36.876Z  INFO 1 --- [main] com.netflix.discovery.DiscoveryClient: Application version is -1: true
    2024-03-19T21:18:36.876Z  INFO 1 --- [main] com.netflix.discovery.DiscoveryClient: Getting all instance registry info from the eureka server
    2024-03-19T21:18:37.192Z  INFO 1 --- [main] c.n.d.s.t.d.RedirectingEurekaHttpClient  : Request execution error. endpoint=DefaultEndpoint{ serviceUrl='http://localhost:8761/eureka/}, exception=java.net.ConnectException: Connection refused 
stacktrace=jakarta.ws.rs.ProcessingException: java.net.ConnectException: Connection refused
        at org.glassfish.jersey.client.internal.HttpUrlConnector.apply(HttpUrlConnector.java:270)
        at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:300)
        at org.glassfish.jersey.client.JerseyInvocation.lambda$invoke$0(JerseyInvocation.java:662)
        at org.glassfish.jersey.client.JerseyInvocation.call(JerseyInvocation.java:697)
        at org.glassfish.jersey.client.JerseyInvocation.lambda$runInScope$3(JerseyInvocation.java:691)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:292)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:274)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:205)
        at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:390)
        at org.glassfish.jersey.client.JerseyInvocation.runInScope(JerseyInvocation.java:691)
        at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:661)
        at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:413)
        at org.glassfish.jersey.client.JerseyInvocation$Builder.get(JerseyInvocation.java:313)
        at com.netflix.discovery.shared.transport.jersey3.AbstractJersey3EurekaHttpClient.getApplicationsInternal(AbstractJersey3EurekaHttpClient.java:266)
        at com.netflix.discovery.shared.transport.jersey3.AbstractJersey3EurekaHttpClient.getApplications(AbstractJersey3EurekaHttpClient.java:213)
        at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator$6.execute(EurekaHttpClientDecorator.java:137)
        at com.netflix.discovery.shared.transport.decorator.MetricsCollectingEurekaHttpClient.execute(MetricsCollectingEurekaHttpClient.java:73)
        at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.getApplications(EurekaHttpClientDecorator.java:134)
        at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator$6.execute(EurekaHttpClientDecorator.java:137)
        at com.netflix.discovery.shared.transport.decorator.RedirectingEurekaHttpClient.executeOnNewServer(RedirectingEurekaHttpClient.java:121)
        at com.netflix.discovery.shared.transport.decorator.RedirectingEurekaHttpClient.execute(RedirectingEurekaHttpClient.java:80)
        at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.getApplications(EurekaHttpClientDecorator.java:134)
        at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator$6.execute(EurekaHttpClientDecorator.java:137)
        at com.netflix.discovery.shared.transport.decorator.RetryableEurekaHttpClient.execute(RetryableEurekaHttpClient.java:120)
        at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.getApplications(EurekaHttpClientDecorator.java:134)
        at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator$6.execute(EurekaHttpClientDecorator.java:137)
        at com.netflix.discovery.shared.transport.decorator.SessionedEurekaHttpClient.execute(SessionedEurekaHttpClient.java:77)
        at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.getApplications(EurekaHttpClientDecorator.java:134)
        at com.netflix.discovery.DiscoveryClient.getAndStoreFullRegistry(DiscoveryClient.java:1045)
        at com.netflix.discovery.DiscoveryClient.fetchRegistry(DiscoveryClient.java:958)
        at com.netflix.discovery.DiscoveryClient.<init>(DiscoveryClient.java:396)
        at com.netflix.discovery.DiscoveryClient.<init>(DiscoveryClient.java:247)
        at com.netflix.discovery.DiscoveryClient.<init>(DiscoveryClient.java:242)
        at org.springframework.cloud.netflix.eureka.CloudEurekaClient.<init>(CloudEurekaClient.java:68)
        at org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration$RefreshableEurekaClientConfiguration.eurekaClient(EurekaClientAutoConfiguration.java:320)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:139)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:650)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:642)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1330)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1160)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:558)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:518)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$1(AbstractBeanFactory.java:364)
        at org.springframework.cloud.context.scope.GenericScope$BeanLifecycleWrapper.getBean(GenericScope.java:375)
        at org.springframework.cloud.context.scope.GenericScope.get(GenericScope.java:179)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:361)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
        at org.springframework.aop.target.SimpleBeanTargetSource.getTarget(SimpleBeanTargetSource.java:35)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:224)
        at jdk.proxy2/jdk.proxy2.$Proxy74.getApplications(Unknown Source)
        at org.springframework.cloud.netflix.eureka.server.EurekaServerAutoConfiguration.peerAwareInstanceRegistry(EurekaServerAutoConfiguration.java:211)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:139)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:650)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:642)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1330)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1160)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:558)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:518)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
        at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:254)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1417)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1337)
        at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:910)
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:788)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:545)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1330)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1160)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:558)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:518)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
        at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:254)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1417)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1337)
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:773)
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:756)
        at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:145)
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:497)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1414)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:595)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:518)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:973)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:950)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:616)
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:746)
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:448)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:324)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1321)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1310)
        at com.gustavo.discoveryserver.DiscoveryServerApplication.main(DiscoveryServerApplication.java:12)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:95)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:65)
    Caused by: java.net.ConnectException: Connection refused
        at java.base/sun.nio.ch.Net.pollConnect(Native Method)
        at java.base/sun.nio.ch.Net.pollConnectNow(Net.java:672)
        at java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(NioSocketImpl.java:542)
        at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:597)
        at java.base/java.net.Socket.connect(Socket.java:633)
        at java.base/sun.net.NetworkClient.doConnect(NetworkClient.java:178)
        at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:498)
        at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:603)
        at java.base/sun.net.www.http.HttpClient.<init>(HttpClient.java:246)
        at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:351)
        at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:373)
        at java.base/sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1309)
        at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1242)
        at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1128)
        at java.base/sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:1057)
        at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1665)
        at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1589)
        at java.base/java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:529)
        at org.glassfish.jersey.client.internal.HttpUrlConnector._apply(HttpUrlConnector.java:423)
        at org.glassfish.jersey.client.internal.HttpUrlConnector.apply(HttpUrlConnector.java:268)
        ... 115 more

2024-03-19T21:18:37.192Z  WARN 1 --- [main] c.n.d.s.t.d.RetryableEurekaHttpClient: Request execution failed with message: java.net.ConnectException: Connection refused
2024-03-19T21:18:37.194Z  INFO 1 --- [main] com.netflix.discovery.DiscoveryClient: DiscoveryClient_DISCOVERY-SERVER/245b579f1c93:discovery-server - was unable to refresh its cache! This periodic background refresh will be retried in 30 seconds. status = Cannot execute request on any known server stacktrace = com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server     
java spring docker docker-compose
1个回答
0
投票

请问你找到解决办法了吗?我有确切的错误,但我被卡住了

© www.soinside.com 2019 - 2024. All rights reserved.