使用带有 jdk11 的 Amazon SDK 请求兼容 S3 的服务(适用于 jdk8)(TLS 1.2/1.3 问题)
Requesting S3-compatible service using Amazon SDK with jdk11 (works with jdk8) (TLS 1.2/1.3 problem)
我正在尝试设置一个使用 Amazon SDK (com.amazonaws aws-java-sdk 1.12.12) 的微服务。当我 运行 使用 openJ9 JDK 8 进行测试时,它起作用了。当我 运行 使用 openJ9 JDK 11 进行测试时,它们在 listObjectsV2 处失败并出现以下错误:com.amazonaws.SdkClientException: Unable to execute HTTP request: The target server failed to respond
有没有人遇到同样的问题并有解决办法?
我使用代理并使用与亚马逊兼容的 S3 服务器。
完整的堆栈跟踪:
com.amazonaws.SdkClientException: Unable to execute HTTP request: The target server failed to respond
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleRetryableException(AmazonHttpClient.java:1207)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1153)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:802)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeWithTimer(AmazonHttpClient.java:770)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:744)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.access0(AmazonHttpClient.java:704)
at com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:686)
at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:550)
at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:530)
at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:5437)
at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:5384)
at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:5378)
at com.amazonaws.services.s3.AmazonS3Client.listObjectsV2(AmazonS3Client.java:970)
at com.amazonaws.services.s3.AmazonS3Client.listObjectsV2(AmazonS3Client.java:933)
at com.bw.clio.ged.service.S3ServiceTest.testS3(S3ServiceTest.java:57)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:688)
at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149)
at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:140)
at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:84)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor$$Lambda5/0x0000000000000000.apply(Unknown Source)
at org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod[=10=](ExecutableInvoker.java:115)
at org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall$$Lambda6/0x0000000000000000.apply(Unknown Source)
at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke[=10=](ExecutableInvoker.java:105)
at org.junit.jupiter.engine.execution.ExecutableInvoker$$Lambda1/0x0000000000000000.apply(Unknown Source)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod(TestMethodTestDescriptor.java:210)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor$$Lambda1/0x0000000000000000.execute(Unknown Source)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:206)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:131)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:65)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda9/0x0000000000000000.execute(Unknown Source)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively(NodeTestTask.java:129)
at org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda8/0x0000000000000000.invoke(Unknown Source)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively(NodeTestTask.java:127)
at org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda7/0x0000000000000000.execute(Unknown Source)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService$$Lambda3/0x0000000000000000.accept(Unknown Source)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively(NodeTestTask.java:143)
at org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda9/0x0000000000000000.execute(Unknown Source)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively(NodeTestTask.java:129)
at org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda8/0x0000000000000000.invoke(Unknown Source)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively(NodeTestTask.java:127)
at org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda7/0x0000000000000000.execute(Unknown Source)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService$$Lambda3/0x0000000000000000.accept(Unknown Source)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively(NodeTestTask.java:143)
at org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda9/0x0000000000000000.execute(Unknown Source)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively(NodeTestTask.java:129)
at org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda8/0x0000000000000000.invoke(Unknown Source)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively(NodeTestTask.java:127)
at org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda7/0x0000000000000000.execute(Unknown Source)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:108)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute[=10=](EngineExecutionOrchestrator.java:54)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator$$Lambda1/0x0000000000000000.accept(Unknown Source)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:96)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:84)
at org.eclipse.jdt.internal.junit5.runner.JUnit5TestReference.run(JUnit5TestReference.java:98)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:542)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:770)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:464)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)
Caused by: org.apache.http.NoHttpResponseException: The target server failed to respond
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:141)
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56)
at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259)
at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:163)
at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:157)
at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273)
at com.amazonaws.http.protocol.SdkHttpRequestExecutor.doReceiveResponse(SdkHttpRequestExecutor.java:82)
at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:272)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56)
at com.amazonaws.http.apache.client.impl.SdkHttpClient.execute(SdkHttpClient.java:72)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeOneRequest(AmazonHttpClient.java:1331)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1145)
... 96 more
我尝试 运行 的代码是:
String accessKey = "[edited]";
String secretKey = "[edited as well]";
System.setProperty("javax.net.ssl.trustStore", "c:/test_S3/non-amazon-s3-compatible.fr.jks");
ClientConfiguration configuration = new ClientConfiguration() //
.withProxyHost("192.168.100.100") //
.withProxyPort(1234) //
;
AWSCredentials credentials = new BasicAWSCredentials(accessKey, secretKey);
EndpointConfiguration endpointConfiguration = new EndpointConfiguration("non-amazon-s3-compatible.fr", null);
AmazonS3 client = AmazonS3ClientBuilder //
.standard() //
.withEndpointConfiguration(endpointConfiguration) //
.withCredentials(new AWSStaticCredentialsProvider(credentials)) //
.withClientConfiguration(configuration) //
.build();
Bucket bucket = new Bucket("BucketName");
String bucketName = "/" + bucket.getName();
ListObjectsV2Result listObjectsV2Result = client.listObjectsV2(bucketName);
我打开了调试输出并获得了这个:
17:50:32.075 [main] DEBUG com.amazonaws.request - Retrying Request: GET https://non-amazon-s3-compatible.fr /BucketName/ Parameters: ({"list-type":["2"],"fetch-owner":["false"]}Headers: (amz-sdk-invocation-id: 71e3acd8-815c-c073-4c4c-a69e40d7bba9, Content-Type: application/octet-stream, User-Agent: aws-sdk-java/1.12.12 Windows_10/10.0 Eclipse_OpenJ9_VM/openj9-0.24.0 java/11.0.10 vendor/AdoptOpenJDK cfg/retry-mode/legacy, )
17:50:32.075 [main] DEBUG com.amazonaws.http.AmazonHttpClient - Retriable error detected, will retry in 74ms, attempt number: 2
17:50:32.155 [main] DEBUG com.amazonaws.auth.AWS4Signer - AWS4 Canonical Request: '"GET
/BucketName/
fetch-owner=false&list-type=2
amz-sdk-invocation-id:71e3acd8-815c-c073-4c4c-a69e40d7bba9
amz-sdk-request:attempt=4;max=4
amz-sdk-retry:3/74/485
content-type:application/octet-stream
host:non-amazon-s3-compatible.fr
user-agent:aws-sdk-java/1.12.12 Windows_10/10.0 Eclipse_OpenJ9_VM/openj9-0.24.0 java/11.0.10 vendor/AdoptOpenJDK cfg/retry-mode/legacy
x-amz-content-sha256:UNSIGNED-PAYLOAD
x-amz-date:20210802T155032Z
amz-sdk-invocation-id;amz-sdk-request;amz-sdk-retry;content-type;host;user-agent;x-amz-content-sha256;x-amz-date
UNSIGNED-PAYLOAD"
17:50:32.155 [main] DEBUG com.amazonaws.auth.AWS4Signer - AWS4 String to Sign: '"AWS4-HMAC-SHA256
20210802T155032Z
20210802/france/s3/aws4_request
44af32d6b8a146492f9008599ca784b365da39b6bd116ebca1760b27e0f6ccae"
17:50:32.156 [main] DEBUG org.apache.http.client.protocol.RequestAddCookies - CookieSpec selected: default
17:50:32.156 [main] DEBUG org.apache.http.client.protocol.RequestAuthCache - Auth cache not set in the context
17:50:32.156 [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection request: [route: {tls}->http://192.168.100.100:1234->https://non-amazon-s3-compatible.fr:443][total available: 0; route allocated: 0 of 50; total allocated: 0 of 50]
17:50:32.156 [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection leased: [id: 3][route: {tls}->http://192.168.100.100:1234->https://non-amazon-s3-compatible.fr:443][total available: 0; route allocated: 1 of 50; total allocated: 1 of 50]
17:50:32.156 [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Opening connection {tls}->http://192.168.100.100:1234->https://non-amazon-s3-compatible.fr:443
17:50:32.157 [main] DEBUG org.apache.http.impl.conn.DefaultHttpClientConnectionOperator - Connecting to /192.168.100.100:1234
17:50:32.159 [main] DEBUG org.apache.http.impl.conn.DefaultHttpClientConnectionOperator - Connection established 192.168.1.204:56116<->192.168.100.100:1234
17:50:32.159 [main] DEBUG org.apache.http.headers - http-outgoing-3 >> CONNECT non-amazon-s3-compatible.fr:443 HTTP/1.1
17:50:32.159 [main] DEBUG org.apache.http.headers - http-outgoing-3 >> Host: non-amazon-s3-compatible.fr
17:50:32.159 [main] DEBUG org.apache.http.headers - http-outgoing-3 >> User-Agent: Apache-HttpClient/4.5.13 (Java/11.0.10)
17:50:32.159 [main] DEBUG org.apache.http.wire - http-outgoing-3 >> "CONNECT non-amazon-s3-compatible.fr:443 HTTP/1.1[\r][\n]"
17:50:32.159 [main] DEBUG org.apache.http.wire - http-outgoing-3 >> "Host: non-amazon-s3-compatible.fr[\r][\n]"
17:50:32.159 [main] DEBUG org.apache.http.wire - http-outgoing-3 >> "User-Agent: Apache-HttpClient/4.5.13 (Java/11.0.10)[\r][\n]"
17:50:32.159 [main] DEBUG org.apache.http.wire - http-outgoing-3 >> "[\r][\n]"
17:50:32.168 [main] DEBUG org.apache.http.wire - http-outgoing-3 << "HTTP/1.0 200 Connection established[\r][\n]"
17:50:32.168 [main] DEBUG org.apache.http.wire - http-outgoing-3 << "[\r][\n]"
17:50:32.168 [main] DEBUG org.apache.http.headers - http-outgoing-3 << HTTP/1.0 200 Connection established
17:50:32.168 [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Tunnel to target created.
17:50:32.170 [main] DEBUG com.amazonaws.http.conn.ssl.SdkTLSSocketFactory - Enabled protocols: [TLSv1.3, TLSv1.2, TLSv1.1, TLSv1]
17:50:32.170 [main] DEBUG com.amazonaws.http.conn.ssl.SdkTLSSocketFactory - Enabled cipher suites:[TLS_AES_128_GCM_SHA256, TLS_AES_256_GCM_SHA384, TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, TLS_RSA_WITH_AES_256_GCM_SHA384, TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384, TLS_DHE_RSA_WITH_AES_256_GCM_SHA384, TLS_DHE_DSS_WITH_AES_256_GCM_SHA384, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_DSS_WITH_AES_128_GCM_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384, TLS_DHE_RSA_WITH_AES_256_CBC_SHA256, TLS_DHE_DSS_WITH_AES_256_CBC_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDH_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_DSS_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_DSS_WITH_AES_128_CBC_SHA256, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA, TLS_EMPTY_RENEGOTIATION_INFO_SCSV]
17:50:32.170 [main] DEBUG com.amazonaws.http.conn.ssl.SdkTLSSocketFactory - socket.getSupportedProtocols(): [TLSv1.3, TLSv1.2, TLSv1.1, TLSv1, SSLv3, SSLv2Hello], socket.getEnabledProtocols(): [TLSv1.3, TLSv1.2, TLSv1.1, TLSv1]
17:50:32.170 [main] DEBUG com.amazonaws.http.conn.ssl.SdkTLSSocketFactory - TLS protocol enabled for SSL handshake: [TLSv1.2, TLSv1.1, TLSv1, TLSv1.3]
17:50:32.170 [main] DEBUG com.amazonaws.http.conn.ssl.SdkTLSSocketFactory - Starting handshake
17:50:32.191 [main] DEBUG com.amazonaws.http.conn.ssl.SdkTLSSocketFactory - Secure session established
17:50:32.191 [main] DEBUG com.amazonaws.http.conn.ssl.SdkTLSSocketFactory - negotiated protocol: TLSv1.3
17:50:32.191 [main] DEBUG com.amazonaws.http.conn.ssl.SdkTLSSocketFactory - negotiated cipher suite: TLS_AES_128_GCM_SHA256
17:50:32.191 [main] DEBUG com.amazonaws.http.conn.ssl.SdkTLSSocketFactory - peer principal: CN=non-amazon-s3-compatible.fr, OU=0002 34305956400959, O=SFR, L=PARIS, C=FR
17:50:32.191 [main] DEBUG com.amazonaws.http.conn.ssl.SdkTLSSocketFactory - peer alternative names: [non-amazon-s3-compatible.fr]
17:50:32.191 [main] DEBUG com.amazonaws.http.conn.ssl.SdkTLSSocketFactory - issuer principal: CN=Certigna Wild CA, OID.2.5.4.97=NTRFR-48146308100036, OU=0002 48146308100036, O=DHIMYOTIS, C=FR
17:50:32.191 [main] DEBUG org.apache.http.impl.conn.DefaultManagedHttpClientConnection - http-outgoing-3: set socket timeout to 50000
17:50:32.191 [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Executing request GET /BucketName/?list-type=2&fetch-owner=false HTTP/1.1
17:50:32.192 [main] DEBUG org.apache.http.headers - http-outgoing-3 >> GET /BucketName/?list-type=2&fetch-owner=false HTTP/1.1
17:50:32.192 [main] DEBUG org.apache.http.headers - http-outgoing-3 >> Host: non-amazon-s3-compatible.fr
17:50:32.192 [main] DEBUG org.apache.http.headers - http-outgoing-3 >> amz-sdk-invocation-id: 71e3acd8-815c-c073-4c4c-a69e40d7bba9
17:50:32.192 [main] DEBUG org.apache.http.headers - http-outgoing-3 >> amz-sdk-request: attempt=4;max=4
17:50:32.192 [main] DEBUG org.apache.http.headers - http-outgoing-3 >> amz-sdk-retry: 3/74/485
17:50:32.192 [main] DEBUG org.apache.http.headers - http-outgoing-3 >> Authorization: AWS4-HMAC-SHA256 Credential=[edited]/20210802/france/s3/aws4_request, SignedHeaders=amz-sdk-invocation-id;amz-sdk-request;amz-sdk-retry;content-type;host;user-agent;x-amz-content-sha256;x-amz-date, Signature=f6ad209e0698b9ed8ba51946132884cdadacd443face7ca34d5113834403b265
17:50:32.192 [main] DEBUG org.apache.http.headers - http-outgoing-3 >> Content-Type: application/octet-stream
17:50:32.192 [main] DEBUG org.apache.http.headers - http-outgoing-3 >> User-Agent: aws-sdk-java/1.12.12 Windows_10/10.0 Eclipse_OpenJ9_VM/openj9-0.24.0 java/11.0.10 vendor/AdoptOpenJDK cfg/retry-mode/legacy
17:50:32.192 [main] DEBUG org.apache.http.headers - http-outgoing-3 >> x-amz-content-sha256: UNSIGNED-PAYLOAD
17:50:32.192 [main] DEBUG org.apache.http.headers - http-outgoing-3 >> X-Amz-Date: 20210802T155032Z
17:50:32.192 [main] DEBUG org.apache.http.headers - http-outgoing-3 >> Content-Length: 0
17:50:32.192 [main] DEBUG org.apache.http.headers - http-outgoing-3 >> Connection: Keep-Alive
17:50:32.192 [main] DEBUG org.apache.http.wire - http-outgoing-3 >> "GET /BucketName/?list-type=2&fetch-owner=false HTTP/1.1[\r][\n]"
17:50:32.192 [main] DEBUG org.apache.http.wire - http-outgoing-3 >> "Host: non-amazon-s3-compatible.fr[\r][\n]"
17:50:32.192 [main] DEBUG org.apache.http.wire - http-outgoing-3 >> "amz-sdk-invocation-id: 71e3acd8-815c-c073-4c4c-a69e40d7bba9[\r][\n]"
17:50:32.192 [main] DEBUG org.apache.http.wire - http-outgoing-3 >> "amz-sdk-request: attempt=4;max=4[\r][\n]"
17:50:32.192 [main] DEBUG org.apache.http.wire - http-outgoing-3 >> "amz-sdk-retry: 3/74/485[\r][\n]"
17:50:32.192 [main] DEBUG org.apache.http.wire - http-outgoing-3 >> "Authorization: AWS4-HMAC-SHA256 Credential=[edited]/20210802/france/s3/aws4_request, SignedHeaders=amz-sdk-invocation-id;amz-sdk-request;amz-sdk-retry;content-type;host;user-agent;x-amz-content-sha256;x-amz-date, Signature=f6ad209e0698b9ed8ba51946132884cdadacd443face7ca34d5113834403b265[\r][\n]"
17:50:32.192 [main] DEBUG org.apache.http.wire - http-outgoing-3 >> "Content-Type: application/octet-stream[\r][\n]"
17:50:32.192 [main] DEBUG org.apache.http.wire - http-outgoing-3 >> "User-Agent: aws-sdk-java/1.12.12 Windows_10/10.0 Eclipse_OpenJ9_VM/openj9-0.24.0 java/11.0.10 vendor/AdoptOpenJDK cfg/retry-mode/legacy[\r][\n]"
17:50:32.192 [main] DEBUG org.apache.http.wire - http-outgoing-3 >> "x-amz-content-sha256: UNSIGNED-PAYLOAD[\r][\n]"
17:50:32.192 [main] DEBUG org.apache.http.wire - http-outgoing-3 >> "X-Amz-Date: 20210802T155032Z[\r][\n]"
17:50:32.192 [main] DEBUG org.apache.http.wire - http-outgoing-3 >> "Content-Length: 0[\r][\n]"
17:50:32.193 [main] DEBUG org.apache.http.wire - http-outgoing-3 >> "Connection: Keep-Alive[\r][\n]"
17:50:32.193 [main] DEBUG org.apache.http.wire - http-outgoing-3 >> "[\r][\n]"
17:50:32.198 [main] DEBUG org.apache.http.wire - http-outgoing-3 << "end of stream"
17:50:32.198 [main] DEBUG org.apache.http.impl.conn.DefaultManagedHttpClientConnection - http-outgoing-3: Close connection
17:50:32.198 [main] DEBUG org.apache.http.impl.conn.DefaultManagedHttpClientConnection - http-outgoing-3: Shutdown connection
17:50:32.198 [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Connection discarded
17:50:32.199 [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection released: [id: 3][route: {tls}->http://192.168.100.100:1234->https://non-amazon-s3-compatible.fr:443][total available: 0; route allocated: 0 of 50; total allocated: 0 of 50]
17:50:32.199 [main] DEBUG com.amazonaws.http.AmazonHttpClient - Unable to execute HTTP request: The target server failed to respond
使用 TLS 1.3 时出现问题,我假设默认使用 jdk11。
我通过将 Amazon 客户端配置为仅使用 TLS 1.2 和选定的密码来设法避免该问题:
import org.apache.http.conn.ssl.DefaultHostnameVerifier;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.ssl.SSLContexts;
import org.apache.tomcat.util.net.openssl.ciphers.Cipher;
[...]
ClientConfiguration configuration = new ClientConfiguration() //
.withProxyHost("192.168.100.100") //
.withProxyPort(1234) //
;
SSLConnectionSocketFactory sslConnectionSocketFactory = new SSLConnectionSocketFactory(
SSLContexts.custom().build(), new String[] { "TLSv1.2" },
new String[] { Cipher.TLS_DHE_RSA_WITH_AES_256_CBC_SHA.toString() }, new DefaultHostnameVerifier());
configuration.getApacheHttpClientConfig().setSslSocketFactory(sslConnectionSocketFactory);
我正在尝试设置一个使用 Amazon SDK (com.amazonaws aws-java-sdk 1.12.12) 的微服务。当我 运行 使用 openJ9 JDK 8 进行测试时,它起作用了。当我 运行 使用 openJ9 JDK 11 进行测试时,它们在 listObjectsV2 处失败并出现以下错误:com.amazonaws.SdkClientException: Unable to execute HTTP request: The target server failed to respond
有没有人遇到同样的问题并有解决办法?
我使用代理并使用与亚马逊兼容的 S3 服务器。
完整的堆栈跟踪:
com.amazonaws.SdkClientException: Unable to execute HTTP request: The target server failed to respond
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleRetryableException(AmazonHttpClient.java:1207)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1153)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:802)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeWithTimer(AmazonHttpClient.java:770)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:744)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.access0(AmazonHttpClient.java:704)
at com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:686)
at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:550)
at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:530)
at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:5437)
at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:5384)
at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:5378)
at com.amazonaws.services.s3.AmazonS3Client.listObjectsV2(AmazonS3Client.java:970)
at com.amazonaws.services.s3.AmazonS3Client.listObjectsV2(AmazonS3Client.java:933)
at com.bw.clio.ged.service.S3ServiceTest.testS3(S3ServiceTest.java:57)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:688)
at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149)
at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:140)
at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:84)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor$$Lambda5/0x0000000000000000.apply(Unknown Source)
at org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod[=10=](ExecutableInvoker.java:115)
at org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall$$Lambda6/0x0000000000000000.apply(Unknown Source)
at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke[=10=](ExecutableInvoker.java:105)
at org.junit.jupiter.engine.execution.ExecutableInvoker$$Lambda1/0x0000000000000000.apply(Unknown Source)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod(TestMethodTestDescriptor.java:210)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor$$Lambda1/0x0000000000000000.execute(Unknown Source)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:206)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:131)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:65)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda9/0x0000000000000000.execute(Unknown Source)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively(NodeTestTask.java:129)
at org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda8/0x0000000000000000.invoke(Unknown Source)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively(NodeTestTask.java:127)
at org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda7/0x0000000000000000.execute(Unknown Source)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService$$Lambda3/0x0000000000000000.accept(Unknown Source)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively(NodeTestTask.java:143)
at org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda9/0x0000000000000000.execute(Unknown Source)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively(NodeTestTask.java:129)
at org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda8/0x0000000000000000.invoke(Unknown Source)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively(NodeTestTask.java:127)
at org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda7/0x0000000000000000.execute(Unknown Source)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService$$Lambda3/0x0000000000000000.accept(Unknown Source)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively(NodeTestTask.java:143)
at org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda9/0x0000000000000000.execute(Unknown Source)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively(NodeTestTask.java:129)
at org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda8/0x0000000000000000.invoke(Unknown Source)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively(NodeTestTask.java:127)
at org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda7/0x0000000000000000.execute(Unknown Source)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:108)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute[=10=](EngineExecutionOrchestrator.java:54)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator$$Lambda1/0x0000000000000000.accept(Unknown Source)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:96)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:84)
at org.eclipse.jdt.internal.junit5.runner.JUnit5TestReference.run(JUnit5TestReference.java:98)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:542)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:770)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:464)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)
Caused by: org.apache.http.NoHttpResponseException: The target server failed to respond
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:141)
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56)
at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259)
at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:163)
at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:157)
at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273)
at com.amazonaws.http.protocol.SdkHttpRequestExecutor.doReceiveResponse(SdkHttpRequestExecutor.java:82)
at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:272)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56)
at com.amazonaws.http.apache.client.impl.SdkHttpClient.execute(SdkHttpClient.java:72)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeOneRequest(AmazonHttpClient.java:1331)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1145)
... 96 more
我尝试 运行 的代码是:
String accessKey = "[edited]";
String secretKey = "[edited as well]";
System.setProperty("javax.net.ssl.trustStore", "c:/test_S3/non-amazon-s3-compatible.fr.jks");
ClientConfiguration configuration = new ClientConfiguration() //
.withProxyHost("192.168.100.100") //
.withProxyPort(1234) //
;
AWSCredentials credentials = new BasicAWSCredentials(accessKey, secretKey);
EndpointConfiguration endpointConfiguration = new EndpointConfiguration("non-amazon-s3-compatible.fr", null);
AmazonS3 client = AmazonS3ClientBuilder //
.standard() //
.withEndpointConfiguration(endpointConfiguration) //
.withCredentials(new AWSStaticCredentialsProvider(credentials)) //
.withClientConfiguration(configuration) //
.build();
Bucket bucket = new Bucket("BucketName");
String bucketName = "/" + bucket.getName();
ListObjectsV2Result listObjectsV2Result = client.listObjectsV2(bucketName);
我打开了调试输出并获得了这个:
17:50:32.075 [main] DEBUG com.amazonaws.request - Retrying Request: GET https://non-amazon-s3-compatible.fr /BucketName/ Parameters: ({"list-type":["2"],"fetch-owner":["false"]}Headers: (amz-sdk-invocation-id: 71e3acd8-815c-c073-4c4c-a69e40d7bba9, Content-Type: application/octet-stream, User-Agent: aws-sdk-java/1.12.12 Windows_10/10.0 Eclipse_OpenJ9_VM/openj9-0.24.0 java/11.0.10 vendor/AdoptOpenJDK cfg/retry-mode/legacy, )
17:50:32.075 [main] DEBUG com.amazonaws.http.AmazonHttpClient - Retriable error detected, will retry in 74ms, attempt number: 2
17:50:32.155 [main] DEBUG com.amazonaws.auth.AWS4Signer - AWS4 Canonical Request: '"GET
/BucketName/
fetch-owner=false&list-type=2
amz-sdk-invocation-id:71e3acd8-815c-c073-4c4c-a69e40d7bba9
amz-sdk-request:attempt=4;max=4
amz-sdk-retry:3/74/485
content-type:application/octet-stream
host:non-amazon-s3-compatible.fr
user-agent:aws-sdk-java/1.12.12 Windows_10/10.0 Eclipse_OpenJ9_VM/openj9-0.24.0 java/11.0.10 vendor/AdoptOpenJDK cfg/retry-mode/legacy
x-amz-content-sha256:UNSIGNED-PAYLOAD
x-amz-date:20210802T155032Z
amz-sdk-invocation-id;amz-sdk-request;amz-sdk-retry;content-type;host;user-agent;x-amz-content-sha256;x-amz-date
UNSIGNED-PAYLOAD"
17:50:32.155 [main] DEBUG com.amazonaws.auth.AWS4Signer - AWS4 String to Sign: '"AWS4-HMAC-SHA256
20210802T155032Z
20210802/france/s3/aws4_request
44af32d6b8a146492f9008599ca784b365da39b6bd116ebca1760b27e0f6ccae"
17:50:32.156 [main] DEBUG org.apache.http.client.protocol.RequestAddCookies - CookieSpec selected: default
17:50:32.156 [main] DEBUG org.apache.http.client.protocol.RequestAuthCache - Auth cache not set in the context
17:50:32.156 [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection request: [route: {tls}->http://192.168.100.100:1234->https://non-amazon-s3-compatible.fr:443][total available: 0; route allocated: 0 of 50; total allocated: 0 of 50]
17:50:32.156 [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection leased: [id: 3][route: {tls}->http://192.168.100.100:1234->https://non-amazon-s3-compatible.fr:443][total available: 0; route allocated: 1 of 50; total allocated: 1 of 50]
17:50:32.156 [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Opening connection {tls}->http://192.168.100.100:1234->https://non-amazon-s3-compatible.fr:443
17:50:32.157 [main] DEBUG org.apache.http.impl.conn.DefaultHttpClientConnectionOperator - Connecting to /192.168.100.100:1234
17:50:32.159 [main] DEBUG org.apache.http.impl.conn.DefaultHttpClientConnectionOperator - Connection established 192.168.1.204:56116<->192.168.100.100:1234
17:50:32.159 [main] DEBUG org.apache.http.headers - http-outgoing-3 >> CONNECT non-amazon-s3-compatible.fr:443 HTTP/1.1
17:50:32.159 [main] DEBUG org.apache.http.headers - http-outgoing-3 >> Host: non-amazon-s3-compatible.fr
17:50:32.159 [main] DEBUG org.apache.http.headers - http-outgoing-3 >> User-Agent: Apache-HttpClient/4.5.13 (Java/11.0.10)
17:50:32.159 [main] DEBUG org.apache.http.wire - http-outgoing-3 >> "CONNECT non-amazon-s3-compatible.fr:443 HTTP/1.1[\r][\n]"
17:50:32.159 [main] DEBUG org.apache.http.wire - http-outgoing-3 >> "Host: non-amazon-s3-compatible.fr[\r][\n]"
17:50:32.159 [main] DEBUG org.apache.http.wire - http-outgoing-3 >> "User-Agent: Apache-HttpClient/4.5.13 (Java/11.0.10)[\r][\n]"
17:50:32.159 [main] DEBUG org.apache.http.wire - http-outgoing-3 >> "[\r][\n]"
17:50:32.168 [main] DEBUG org.apache.http.wire - http-outgoing-3 << "HTTP/1.0 200 Connection established[\r][\n]"
17:50:32.168 [main] DEBUG org.apache.http.wire - http-outgoing-3 << "[\r][\n]"
17:50:32.168 [main] DEBUG org.apache.http.headers - http-outgoing-3 << HTTP/1.0 200 Connection established
17:50:32.168 [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Tunnel to target created.
17:50:32.170 [main] DEBUG com.amazonaws.http.conn.ssl.SdkTLSSocketFactory - Enabled protocols: [TLSv1.3, TLSv1.2, TLSv1.1, TLSv1]
17:50:32.170 [main] DEBUG com.amazonaws.http.conn.ssl.SdkTLSSocketFactory - Enabled cipher suites:[TLS_AES_128_GCM_SHA256, TLS_AES_256_GCM_SHA384, TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, TLS_RSA_WITH_AES_256_GCM_SHA384, TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384, TLS_DHE_RSA_WITH_AES_256_GCM_SHA384, TLS_DHE_DSS_WITH_AES_256_GCM_SHA384, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_DSS_WITH_AES_128_GCM_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384, TLS_DHE_RSA_WITH_AES_256_CBC_SHA256, TLS_DHE_DSS_WITH_AES_256_CBC_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDH_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_DSS_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_DSS_WITH_AES_128_CBC_SHA256, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA, TLS_EMPTY_RENEGOTIATION_INFO_SCSV]
17:50:32.170 [main] DEBUG com.amazonaws.http.conn.ssl.SdkTLSSocketFactory - socket.getSupportedProtocols(): [TLSv1.3, TLSv1.2, TLSv1.1, TLSv1, SSLv3, SSLv2Hello], socket.getEnabledProtocols(): [TLSv1.3, TLSv1.2, TLSv1.1, TLSv1]
17:50:32.170 [main] DEBUG com.amazonaws.http.conn.ssl.SdkTLSSocketFactory - TLS protocol enabled for SSL handshake: [TLSv1.2, TLSv1.1, TLSv1, TLSv1.3]
17:50:32.170 [main] DEBUG com.amazonaws.http.conn.ssl.SdkTLSSocketFactory - Starting handshake
17:50:32.191 [main] DEBUG com.amazonaws.http.conn.ssl.SdkTLSSocketFactory - Secure session established
17:50:32.191 [main] DEBUG com.amazonaws.http.conn.ssl.SdkTLSSocketFactory - negotiated protocol: TLSv1.3
17:50:32.191 [main] DEBUG com.amazonaws.http.conn.ssl.SdkTLSSocketFactory - negotiated cipher suite: TLS_AES_128_GCM_SHA256
17:50:32.191 [main] DEBUG com.amazonaws.http.conn.ssl.SdkTLSSocketFactory - peer principal: CN=non-amazon-s3-compatible.fr, OU=0002 34305956400959, O=SFR, L=PARIS, C=FR
17:50:32.191 [main] DEBUG com.amazonaws.http.conn.ssl.SdkTLSSocketFactory - peer alternative names: [non-amazon-s3-compatible.fr]
17:50:32.191 [main] DEBUG com.amazonaws.http.conn.ssl.SdkTLSSocketFactory - issuer principal: CN=Certigna Wild CA, OID.2.5.4.97=NTRFR-48146308100036, OU=0002 48146308100036, O=DHIMYOTIS, C=FR
17:50:32.191 [main] DEBUG org.apache.http.impl.conn.DefaultManagedHttpClientConnection - http-outgoing-3: set socket timeout to 50000
17:50:32.191 [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Executing request GET /BucketName/?list-type=2&fetch-owner=false HTTP/1.1
17:50:32.192 [main] DEBUG org.apache.http.headers - http-outgoing-3 >> GET /BucketName/?list-type=2&fetch-owner=false HTTP/1.1
17:50:32.192 [main] DEBUG org.apache.http.headers - http-outgoing-3 >> Host: non-amazon-s3-compatible.fr
17:50:32.192 [main] DEBUG org.apache.http.headers - http-outgoing-3 >> amz-sdk-invocation-id: 71e3acd8-815c-c073-4c4c-a69e40d7bba9
17:50:32.192 [main] DEBUG org.apache.http.headers - http-outgoing-3 >> amz-sdk-request: attempt=4;max=4
17:50:32.192 [main] DEBUG org.apache.http.headers - http-outgoing-3 >> amz-sdk-retry: 3/74/485
17:50:32.192 [main] DEBUG org.apache.http.headers - http-outgoing-3 >> Authorization: AWS4-HMAC-SHA256 Credential=[edited]/20210802/france/s3/aws4_request, SignedHeaders=amz-sdk-invocation-id;amz-sdk-request;amz-sdk-retry;content-type;host;user-agent;x-amz-content-sha256;x-amz-date, Signature=f6ad209e0698b9ed8ba51946132884cdadacd443face7ca34d5113834403b265
17:50:32.192 [main] DEBUG org.apache.http.headers - http-outgoing-3 >> Content-Type: application/octet-stream
17:50:32.192 [main] DEBUG org.apache.http.headers - http-outgoing-3 >> User-Agent: aws-sdk-java/1.12.12 Windows_10/10.0 Eclipse_OpenJ9_VM/openj9-0.24.0 java/11.0.10 vendor/AdoptOpenJDK cfg/retry-mode/legacy
17:50:32.192 [main] DEBUG org.apache.http.headers - http-outgoing-3 >> x-amz-content-sha256: UNSIGNED-PAYLOAD
17:50:32.192 [main] DEBUG org.apache.http.headers - http-outgoing-3 >> X-Amz-Date: 20210802T155032Z
17:50:32.192 [main] DEBUG org.apache.http.headers - http-outgoing-3 >> Content-Length: 0
17:50:32.192 [main] DEBUG org.apache.http.headers - http-outgoing-3 >> Connection: Keep-Alive
17:50:32.192 [main] DEBUG org.apache.http.wire - http-outgoing-3 >> "GET /BucketName/?list-type=2&fetch-owner=false HTTP/1.1[\r][\n]"
17:50:32.192 [main] DEBUG org.apache.http.wire - http-outgoing-3 >> "Host: non-amazon-s3-compatible.fr[\r][\n]"
17:50:32.192 [main] DEBUG org.apache.http.wire - http-outgoing-3 >> "amz-sdk-invocation-id: 71e3acd8-815c-c073-4c4c-a69e40d7bba9[\r][\n]"
17:50:32.192 [main] DEBUG org.apache.http.wire - http-outgoing-3 >> "amz-sdk-request: attempt=4;max=4[\r][\n]"
17:50:32.192 [main] DEBUG org.apache.http.wire - http-outgoing-3 >> "amz-sdk-retry: 3/74/485[\r][\n]"
17:50:32.192 [main] DEBUG org.apache.http.wire - http-outgoing-3 >> "Authorization: AWS4-HMAC-SHA256 Credential=[edited]/20210802/france/s3/aws4_request, SignedHeaders=amz-sdk-invocation-id;amz-sdk-request;amz-sdk-retry;content-type;host;user-agent;x-amz-content-sha256;x-amz-date, Signature=f6ad209e0698b9ed8ba51946132884cdadacd443face7ca34d5113834403b265[\r][\n]"
17:50:32.192 [main] DEBUG org.apache.http.wire - http-outgoing-3 >> "Content-Type: application/octet-stream[\r][\n]"
17:50:32.192 [main] DEBUG org.apache.http.wire - http-outgoing-3 >> "User-Agent: aws-sdk-java/1.12.12 Windows_10/10.0 Eclipse_OpenJ9_VM/openj9-0.24.0 java/11.0.10 vendor/AdoptOpenJDK cfg/retry-mode/legacy[\r][\n]"
17:50:32.192 [main] DEBUG org.apache.http.wire - http-outgoing-3 >> "x-amz-content-sha256: UNSIGNED-PAYLOAD[\r][\n]"
17:50:32.192 [main] DEBUG org.apache.http.wire - http-outgoing-3 >> "X-Amz-Date: 20210802T155032Z[\r][\n]"
17:50:32.192 [main] DEBUG org.apache.http.wire - http-outgoing-3 >> "Content-Length: 0[\r][\n]"
17:50:32.193 [main] DEBUG org.apache.http.wire - http-outgoing-3 >> "Connection: Keep-Alive[\r][\n]"
17:50:32.193 [main] DEBUG org.apache.http.wire - http-outgoing-3 >> "[\r][\n]"
17:50:32.198 [main] DEBUG org.apache.http.wire - http-outgoing-3 << "end of stream"
17:50:32.198 [main] DEBUG org.apache.http.impl.conn.DefaultManagedHttpClientConnection - http-outgoing-3: Close connection
17:50:32.198 [main] DEBUG org.apache.http.impl.conn.DefaultManagedHttpClientConnection - http-outgoing-3: Shutdown connection
17:50:32.198 [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Connection discarded
17:50:32.199 [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection released: [id: 3][route: {tls}->http://192.168.100.100:1234->https://non-amazon-s3-compatible.fr:443][total available: 0; route allocated: 0 of 50; total allocated: 0 of 50]
17:50:32.199 [main] DEBUG com.amazonaws.http.AmazonHttpClient - Unable to execute HTTP request: The target server failed to respond
使用 TLS 1.3 时出现问题,我假设默认使用 jdk11。
我通过将 Amazon 客户端配置为仅使用 TLS 1.2 和选定的密码来设法避免该问题:
import org.apache.http.conn.ssl.DefaultHostnameVerifier;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.ssl.SSLContexts;
import org.apache.tomcat.util.net.openssl.ciphers.Cipher;
[...]
ClientConfiguration configuration = new ClientConfiguration() //
.withProxyHost("192.168.100.100") //
.withProxyPort(1234) //
;
SSLConnectionSocketFactory sslConnectionSocketFactory = new SSLConnectionSocketFactory(
SSLContexts.custom().build(), new String[] { "TLSv1.2" },
new String[] { Cipher.TLS_DHE_RSA_WITH_AES_256_CBC_SHA.toString() }, new DefaultHostnameVerifier());
configuration.getApacheHttpClientConfig().setSslSocketFactory(sslConnectionSocketFactory);