Caused by: java.net.UnknownHostException: my-new-bucket.s3.yyclouds.com
at java.net.InetAddress.getAllByName0(Unknown Source)
at java.net.InetAddress.getAllByName(Unknown Source)
at java.net.InetAddress.getAllByName(Unknown Source)
at com.amazonaws.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:27)
at com.amazonaws.http.DelegatingDnsResolver.resolve(DelegatingDnsResolver.java:38)
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:111)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
... 63 more
2017-01-23 17:43:19,479 DEBUG [com.amazonaws.request] - <Retrying Request: HEAD http://my-new-bucket.s3.yyclouds.com / Headers: (User-Agent: aws-sdk-java/1.11.69 Windows_8.1/6.3 Java_HotSpot(TM)_Client_VM/25.11-b03/1.8.0_11, amz-sdk-invocation-id: 5f381d32-1c29-95ba-007a-856a127d3362, Content-Type: application/octet-stream, ) >
2017-01-23 17:43:19,479 DEBUG [com.amazonaws.http.AmazonHttpClient] - <Retriable error detected, will retry in 59ms, attempt number: 2>
2017-01-23 17:43:19,538 DEBUG [com.amazonaws.auth.AWS4Signer] - <AWS4 Canonical Request: '"HEAD
ceph rgw java sdk 使用域名访问服务时,如上默认情况下 bucket名会作为子域名,因为这个子域名未注册,所以无法访问。
设置s3client的配置项 PathStyleAccess 为true 即可解决此问题
代码 如下
s3client.setEndpoint("http://s3.yyclouds.com");
//使用域名时,需要如下设置
s3client.setS3ClientOptions(S3ClientOptions.builder().setPathStyleAccess(true).build());