問題描述
將資源上傳到阿里雲Object Storage Service後,通過SDK訪問OSS中的Bucket時,報如下錯誤。
The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint問題原因
未指定Endpoint參數,或者指定的參數有誤。例如Bucket建立在青島地區,卻使用預設配置的oss-cn-hangzhou.aliyuncs.com杭州Endpoint地址去請求,就會出現該報錯。
解決方案
檢查OSS Bucket的Endpoint地址的正確性,具體操作如下:
請確保使用正確的Endpoint地址訪問Bucket。例如Bucket所在地區為
oss-cn-hangzhou,則外網Endpoint為oss-cn-hangzhou.aliyuncs.com。有關Endpoint的更多資訊,請參見OSS訪問網域名稱使用規則。確認請求的Endpoint地址與Bucket實際的Endpoint地址一致。如果需要訪問青島和杭州兩個節點的Bucket,則建立多個Ossclient,定義Endpoint時,將青島和杭州地區的地址都添加進去。各地區及不同網路連接方式下的Endpoint資訊請參見Endpoint。
更多資訊
OSS各地區的外網、內網地址請參見地區和Endpoint對照表。
更多Java SDK內容請參見Java SDK。
適用於
Object Storage Service