线程“main”java.nio.file.accessdeniedexception中的异常:s3a://………………………innermkdirs

s5a0g9ez  于 2021-07-13  发布在  Spark
关注(0)|答案(2)|浏览(719)

技术堆栈-

Spark - 2.4.7,

Scala - 2.11.8,

Running On AWS EMR

因此,我尝试将kinesis流写入特定的s3位置,但对于某些s3问题,我无法这样做。另一个有趣的观察是,在databricks上,相同的代码工作得很好。
我的代码-

transformations.materialization()
      .writeStream
      .trigger(Trigger.ProcessingTime(triggerMatInterval))
      .outputMode(OutputMode.Append())
      .format(DataFormat)
      .option("path", Path)
      .option("checkpointLocation", CheckpointPath) \\Error Takes place here
      .start()

s3位置格式-s3a://d/ef/in/gh/checkpoints/ijk
错误-

Exception in thread "main" java.nio.file.AccessDeniedException: s3a://<S3Location>: innerMkdirs on <Same S3 Location>: com.amazonaws.services.s3.model.AmazonS3Exception: Access Denied (Service: Amazon S3; Status Code: 403; Error Code: AccessDenied; Request ID: 77EA9D8F5F71C60C; S3 Extended Request ID: EH3Su6H/hcQjW/5E6+vEPjWyyy62OKb+CgoU1SCJKzMTt41IfVm8sJLDJTOYo8iIZwrN7GvD4wU=; Proxy: null), S3 Extended Request ID: EH3Su6H/hcQjW/5E6+vEPjWyyy62OKb+CgoU1SCJKzMTt41IfVm8sJLDJTOYo8iIZwrN7GvD4wU=
...
...
...
...
...
...
...
...
...
Caused by: com.amazonaws.services.s3.model.AmazonS3Exception: Access Denied (Service: Amazon S3; Status Code: 403; Error Code: AccessDenied; Request ID: 77EA9D8F5F71C60C; S3 Extended Request ID: EH3Su6H/hcQjW/5E6+vEPjWyyy62OKb+CgoU1SCJKzMTt41IfVm8sJLDJTOYo8iIZwrN7GvD4wU=; Proxy: null), S3 Extended Request ID: EH3Su6H/hcQjW/5E6+vEPjWyyy62OKb+CgoU1SCJKzMTt41IfVm8sJLDJTOYo8iIZwrN7GvD4wU=
    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleErrorResponse(AmazonHttpClient.java:1828)
    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleServiceErrorResponse(AmazonHttpClient.java:1412)
    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeOneRequest(AmazonHttpClient.java:1374)
    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1145)
    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.access$500(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:5219)
    at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:5165)
    at com.amazonaws.services.s3.AmazonS3Client.access$300(AmazonS3Client.java:405)
    at com.amazonaws.services.s3.AmazonS3Client$PutObjectStrategy.invokeServiceCall(AmazonS3Client.java:6180)
    at com.amazonaws.services.s3.AmazonS3Client.uploadObject(AmazonS3Client.java:1824)
    at com.amazonaws.services.s3.AmazonS3Client.putObject(AmazonS3Client.java:1784)
    at com.amazonaws.services.s3.transfer.internal.UploadCallable.uploadInOneChunk(UploadCallable.java:168)
    at com.amazonaws.services.s3.transfer.internal.UploadCallable.call(UploadCallable.java:148)
    at com.amazonaws.services.s3.transfer.internal.UploadMonitor.call(UploadMonitor.java:115)
    at com.amazonaws.services.s3.transfer.internal.UploadMonitor.call(UploadMonitor.java:45)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Command exiting with ret '1'

提前谢谢。

new9mtju

new9mtju1#

尝试更改s3上的s3a://<>
确保您可以从emr所在的同一帐户访问存储桶

ndh0cuux

ndh0cuux2#

无论您作为谁登录,都没有对bucket的写访问权限,或者至少是它试图写入的路径

相关问题