com.amazonaws.sdkclientexception:无法连接到服务端点

5vf7fwbs  于 2021-07-06  发布在  Java
关注(0)|答案(1)|浏览(2266)

在我的spring boot应用程序中,我将aws.java.sdk.version从1.11.510升级到1.11.825,现在出现错误:

com.amazonaws.SdkClientException: Failed to connect to service endpoint -

2020-08-18 16:58:22 [main] INFO  o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext - Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@247bddad: startup date [Tue Aug 18 16:58:22 CDT 2020]; root of context hierarchy
2020-08-18 16:58:23 [main] WARN  c.a.i.InstanceMetadataServiceResourceFetcher - Fail to retrieve token 
com.amazonaws.SdkClientException: Failed to connect to service endpoint: 
    at com.amazonaws.internal.EC2ResourceFetcher.doReadResource(EC2ResourceFetcher.java:100)
    at com.amazonaws.internal.InstanceMetadataServiceResourceFetcher.getToken(InstanceMetadataServiceResourceFetcher.java:91)

pom用途:

<dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.amazonaws</groupId>
                <artifactId>aws-java-sdk-bom</artifactId>
                <version>${aws.java.sdk.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-aws</artifactId>
                <version>${spring.cloud.aws.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-java-sdk-secretsmanager</artifactId>
        </dependency>
cbjzeqam

cbjzeqam1#

这个问题已经在github上讨论过了。但是在我的例子中,我改变了日志级别如下。在application.yml文件中,我添加了

logging:
  level:
    com.amazonaws.util.EC2MetadataUtils: error
    com.amazonaws.internal.InstanceMetadataServiceResourceFetcher: error

相关问题