您现在的位置是:网站首页 > 代码编程 > JAVA开发JAVA开发

【原】阿里云OSS上传文件出错“The bucket you are attempting to access must be addressed using the specified endpoint”

不忘初心 不忘初心 2020-01-09 围观() 评论() 点赞() JAVA开发

简介:这两天建了一个新项目需要用oss,所以在创建了新的bucket之后,就直接将原来项目中的配置拷贝过来,结果分分钟报错:“The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.”,详

这两天建了一个新项目需要用oss,所以在创建了新的bucket之后,就直接将原来项目中的配置拷贝过来,结果分分钟报错:“The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.”,

详细错误信息如下:

com.aliyun.oss.OSSException: The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.
[ErrorCode]: AccessDenied
[RequestId]: 5DF9E1F5EB0E623731F77819
[HostId]: quartet-pay.oss-cn-shanghai.aliyuncs.com
[ResponseError]:
<?xml version="1.0" encoding="UTF-8"?>
<Error>
  <Code>AccessDenied</Code>
  <Message>The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.</Message>
  <RequestId>5DF9E1F5EB0E623731F77819</RequestId>
  <HostId>quartet-pay.oss-cn-shanghai.aliyuncs.com</HostId>
  <Bucket>quartet-pay</Bucket>
  <Endpoint>oss-cn-beijing.aliyuncs.com</Endpoint>
</Error>

	at com.aliyun.oss.common.utils.ExceptionFactory.createOSSException(ExceptionFactory.java:100)
	at com.aliyun.oss.internal.OSSErrorResponseHandler.handle(OSSErrorResponseHandler.java:70)
	at com.aliyun.oss.common.comm.ServiceClient.handleResponse(ServiceClient.java:257)
	at com.aliyun.oss.common.comm.ServiceClient.sendRequestImpl(ServiceClient.java:140)
	at com.aliyun.oss.common.comm.ServiceClient.sendRequest(ServiceClient.java:70)
	at com.aliyun.oss.internal.OSSOperation.send(OSSOperation.java:83)
	at com.aliyun.oss.internal.OSSOperation.doOperation(OSSOperation.java:145)
	at com.aliyun.oss.internal.OSSOperation.doOperation(OSSOperation.java:102)
	at com.aliyun.oss.internal.OSSObjectOperation.writeObjectInternal(OSSObjectOperation.java:1125)
	at com.aliyun.oss.internal.OSSObjectOperation.putObject(OSSObjectOperation.java:130)
	at com.aliyun.oss.OSSClient.putObject(OSSClient.java:494)
	at com.aliyun.oss.OSSClient.putObject(OSSClient.java:478)
	at com.aliyun.oss.OSSClient.putObject(OSSClient.java:472)
	at com.wolffy.util.OssUtil.upload(OssUtil.java:74)
	at com.wolffy.util.OssUtil.main(OssUtil.java:192)

Process finished with exit code 0

一脸懵逼,仔细检查之后,发现是因为point地址写错了。。。

在创建了bucket之后,oss会根据选择的区域自动分配endpoint,我之前新建的bucket选择的是上海,而这个quartet-pay我选择的是北京,所以endpoint应该是oss-cn-beijing.aliyuncs.com,而不应该是oss-cn-shanghai.aliyuncs.com。

阿里云OSS上传文件出错“The bucket you are attempting to access must be addressed using the specified endpoint”

oss

看完文章,有任何疑问,请加入群聊一起交流!!!

很赞哦! ()

文章评论

  • 请先说点什么
    人参与,条评论

请使用电脑浏览器访问本页面,使用手机浏览器访问本页面会导致下载文件异常!!!

雨落无影

关注上方公众号,回复关键字【下载】获取下载码

用完即删,每次下载需重新获取下载码

若出现下载不了的情况,请及时联系站长进行解决

站点信息

  • 网站程序:spring + freemarker
  • 主题模板:《今夕何夕》
  • 文章统计:篇文章
  • 标签管理标签云
  • 微信公众号:扫描二维码,关注我们