S3afilesystem -S3访问密钥和秘密密钥
我正在尝试读/编写S3存储桶并在Java中开发代码。在运行代码时,我会收到访问密钥和秘密密钥的授权错误。
我已经定义了FS如下:
Configuration conf = new Configuration()
S3AFileSystem fs = (S3AFileSystem) FileSystem.get(conf)
FSDataOutputStream ostm = fs.open(new Path(s3bucketpath))
当它创建FS时,它正在引发一个错误:
shaded.databricks.org.apache.hadoop.fs.s3a.S3AFileSystem cannot be cast to org.apache.hadoop.fs.s3a.S3AFileSystem
java.lang.ClassCastException: shaded.databricks.org.apache.hadoop.fs.s3a.S3AFileSystem cannot be cast to org.apache.hadoop.fs.s3a.S3AFileSystem
看起来它正在寻找访问密钥和秘密键,同时创建FS,并且有人可以指导我如何将它们传递到文件系统(conf)。
如果您可以指导我实施此示例代码,请提供示例代码。
谢谢
I am trying to read/write the S3 bucket and develop code in JAVA. While I am running the code I am getting authorization error for Access key and Secret key.
I have defined fs as follows:
Configuration conf = new Configuration()
S3AFileSystem fs = (S3AFileSystem) FileSystem.get(conf)
FSDataOutputStream ostm = fs.open(new Path(s3bucketpath))
while it is creating fs, it is throwing an error :
shaded.databricks.org.apache.hadoop.fs.s3a.S3AFileSystem cannot be cast to org.apache.hadoop.fs.s3a.S3AFileSystem
java.lang.ClassCastException: shaded.databricks.org.apache.hadoop.fs.s3a.S3AFileSystem cannot be cast to org.apache.hadoop.fs.s3a.S3AFileSystem
Looks like it is looking for access key and secret key while creating fs and could someone guide me how we can pass them to FileSystem(conf).
Please provide sample code if you can guide me to implement this.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论