列出gcp存储桶文件时,FSShell NullPointerException

时间:2019-03-27 09:44:09

标签: hadoop google-cloud-platform

我尝试使用从gcp存储桶中检索文件列表,

hadoop fs -ls  gs://bucket-name

但是我遇到以下错误,

Exception in thread "main" java.lang.NullPointerException
at org.apache.hadoop.fs.FsShell.displayError(FsShell.java:304)
at org.apache.hadoop.fs.FsShell.run(FsShell.java:289)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:84)
at org.apache.hadoop.fs.FsShell.main(FsShell.java:340)

我的core-site.xml看起来像

<configuration>
<property>
  <name>fs.gs.impl</name>
  <value>com.google.cloud.hadoop.fs.gcs.GoogleHadoopFileSystem</value>
</property>
<property>
  <name>fs.gs.project.id</name>
  <value>project-id</value>
</property>
<property>
  <name>fs.gs.system.bucket</name>
  <value>bucket-name</value>
</property>
<property>
  <name>fs.gs.working.dir</name>
  <value>/</value>
</property>
<property>
  <name>fs.gs.auth.service.account.enable</name>
  <value>true</value>
</property>
<property>
  <name>fs.gs.auth.service.account.email</name>
  <value>myserviceacc.gserviceaccount.com</value>
</property>
<property>
  <name>fs.gs.auth.service.account.keyfile</name>
  <value>/home/thisara/keys/gcs.json</value>
</property>

这仅在从gcp存储桶获取文件列表时有效。我尝试与本地目录相同,它工作正常。我该如何解决?

0 个答案:

没有答案