开发者社区> 问答> 正文

在e-mapreduce跑hadoop mr报错,com.aliyun.oss.OSSException: AccessDenied

封神 2016-04-15 15:42:11 2288
Error: java.io.IOException: java.lang.reflect.InvocationTargetException
    at com.aliyun.fs.oss.utils.OSSClientAgent.handleException(OSSClientAgent.java:397)
    at com.aliyun.fs.oss.utils.OSSClientAgent.deleteObject(OSSClientAgent.java:217)
    at com.aliyun.fs.oss.nat.JetOssNativeFileSystemStore.delete(JetOssNativeFileSystemStore.java:391)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.apache.hadoop.io.retry.RetryInvocationHandler.invokeMethod(RetryInvocationHandler.java:187)
    at org.apache.hadoop.io.retry.RetryInvocationHandler.invoke(RetryInvocationHandler.java:102)
    at com.sun.proxy.$Proxy14.delete(Unknown Source)
    at com.aliyun.fs.oss.nat.NativeOssFileSystem.rename(NativeOssFileSystem.java:522)
    at org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter.commitTask(FileOutputCommitter.java:445)
    at org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter.commitTask(FileOutputCommitter.java:425)
    at org.apache.hadoop.mapred.Task.commit(Task.java:1163)
    at org.apache.hadoop.mapred.Task.done(Task.java:1025)
    at org.apache.hadoop.mapred.ReduceTask.run(ReduceTask.java:397)
    at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:163)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:415)
    at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1628)
    at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:158)
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at com.aliyun.fs.oss.utils.OSSClientAgent.deleteObject(OSSClientAgent.java:215)
    ... 19 more
Caused by: com.aliyun.oss.OSSException: AccessDenied
[ErrorCode]: AccessDenied
[RequestId]: 57109923941E5EA00A8CC20A
[HostId]: emr-logs2.oss-cn-hangzhou-internal.aliyuncs.com
[ResponseError]:
<?xml version="1.0" encoding="UTF-8"?>
<Error>
  <Code>AccessDenied</Code>
  <Message>AccessDenied</Message>
  <RequestId>57109923941E5EA00A8CC20A</RequestId>
  <HostId>emr-logs2.oss-cn-hangzhou-internal.aliyuncs.com</HostId>
</Error>
    at com.aliyun.oss.common.utils.ExceptionFactory.createOSSException(ExceptionFactory.java:99)
    at com.aliyun.oss.internal.OSSErrorResponseHandler.handle(OSSErrorResponseHandler.java:72)
    at com.aliyun.oss.common.comm.ServiceClient.handleResponse(ServiceClient.java:242)
    at com.aliyun.oss.common.comm.ServiceClient.sendRequestImpl(ServiceClient.java:124)
    at com.aliyun.oss.common.comm.ServiceClient.sendRequest(ServiceClient.java:67)
    at com.aliyun.oss.internal.OSSOperation.send(OSSOperation.java:92)
    at com.aliyun.oss.internal.OSSOperation.doOperation(OSSOperation.java:140)
    at com.aliyun.oss.internal.OSSOperation.doOperation(OSSOperation.java:111)
    at com.aliyun.oss.internal.OSSOperation.doOperation(OSSOperation.java:106)
    at com.aliyun.oss.internal.OSSObjectOperation.deleteObject(OSSObjectOperation.java:386)
    at com.aliyun.oss.OSSClient.deleteObject(OSSClient.java:644)
    at com.aliyun.oss.OSSClient.deleteObject(OSSClient.java:638)
    ... 24 more
XML 分布式计算 Java Hadoop 数据格式
分享到
取消 提交回答
全部回答(1)
  • 封神
    2019-07-17 18:43:21

    这个问题看起来就是 访问OSS的权限不足引起的。
    在此case中,在deleteObject处发生错误。
    一般是是在RAM中,配置策略出现了错误,缺少oss:DeleteObject权限。

    全部的权限应该是:

    {
      "Version": "1",
      "Statement": [
        {
          "Effect": "Allow",
          "Action": [
            "oss:ListBuckets"
          ],
          "Resource": [
            "acs:oss:*:*:*"
          ]
        },
        {
          "Effect": "Allow",
          "Action": [
            "oss:Listobjects",
            "oss:GetObject",
            "oss:PutObject",
            "oss:DeleteObject"
          ],
          "Resource": [
            "acs:oss:*:*:emr-logs2",
            "acs:oss:*:*:emr-logs2/*"
          ]
        }
      ]
    }

    可以参考:https://help.aliyun.com/document_detail/emr/trouble-shooting/oss-ram-control.html?spm=5176.docemr/best-practice/HBase.6.198.BVMujg

    2 0
+ 订阅

大数据计算实践乐园,近距离学习前沿技术

推荐文章
相似问题