Java: FileSystem.getDefaultUri 会导致 StackOverflowError。

huangapple go评论80阅读模式
英文:

Java: StackOverflowError for FileSystem.getDefaultUri

问题

I'm trying to create the instance of Distributed FS:

  Configuration config = new Configuration();
  config.set("fs.defaultFS", "/");
  FileSystem hdfs = FileSystem.get(new URI("/"), config);

Application run at distributed cluster.
But receive the following error:

  Exception in thread "main" java.lang.StackOverflowError
    at java.net.URI.access$300(URI.java:464)
    at java.net.URI$Parser.scan(URI.java:2995)
    at java.net.URI$Parser.checkChars(URI.java:3018)
    at java.net.URI$Parser.parseHierarchical(URI.java:3104)
    at java.net.URI$Parser.parse(URI.java:3062)
    at java.net.URI.<init>(URI.java:588)
    at java.net.URI.create(URI.java:850)
    at org.apache.hadoop.fs.FileSystem.getDefaultUri(FileSystem.java:180)
    at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:172)

Also I tried to configure the instance so:

 FileSystem hdfs = FileSystem.get(config); 

But with the same result.

I have found the ticket for a similar problem: HADOOP-13792
The ticket is resolved for version 2.7.2.

And my version is 3.1.1

英文:

I'm trying to create the instance of Distributed FS:

  Configuration config = new Configuration();
  config.set(&quot;fs.defaultFS&quot;, &quot;/&quot;);
  FileSystem hdfs = FileSystem.get(new URI(&quot;/&quot;), config);

Applicaion run at distribited cluster.
But receive the following error:

  Exception in thread &quot;main&quot; java.lang.StackOverflowError
    at java.net.URI.access$300(URI.java:464)
    at java.net.URI$Parser.scan(URI.java:2995)
    at java.net.URI$Parser.checkChars(URI.java:3018)
    at java.net.URI$Parser.parseHierarchical(URI.java:3104)
    at java.net.URI$Parser.parse(URI.java:3062)
    at java.net.URI.&lt;init&gt;(URI.java:588)
    at java.net.URI.create(URI.java:850)
    at org.apache.hadoop.fs.FileSystem.getDefaultUri(FileSystem.java:180)
    at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:172)

Also I tried to configured instanse so:

 FileSystem hdfs = FileSystem.get(config); 

But with the same result.

I have found the ticket for familiar problem: HADOOP-13792
The ticket is resolved for version 2.7.2.

And my version is 3.1.1

答案1

得分: 1

请为以下部分提供正确的模式和权限:

config.set("fs.defaultFS", "/");

例如 file:///hdfs://namenode:port/

并进行如下更改:

FileSystem hdfs = FileSystem.get(config);
英文:

You should add the correct schema and authority in the

config.set(&quot;fs.defaultFS&quot;, &quot;/&quot;);

Such as file:/// or hdfs://namenode:port/

and change like this

FileSystem hdfs = FileSystem.get(config);

huangapple
  • 本文由 发表于 2023年5月25日 21:03:21
  • 转载请务必保留本文链接:https://go.coder-hub.com/76332580.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定