索引 7 处的权限非法字符:hdfs://localhost:9000 与 hadoop

发布于 2024-12-21 06:40:17 字数 1220 浏览 2 评论 0原文

我正在尝试连接到 hdfs。

Configuration configuration = new Configuration();
configuration.set("fs.default.name", this.hdfsHost);
fs = FileSystem.get(configuration);

hdfsHost 为 127.0.0.1:9000。

但在 FileSystem.get(); 处得到此异常

我有另一个项目运行相同的代码,但运行良好。 有人可以提出任何建议吗? 非常感谢您的

异常跟踪:

Exception in thread "main" java.lang.IllegalArgumentException
at java.net.URI.create(URI.java:842)
at org.apache.hadoop.fs.FileSystem.getDefaultUri(FileSystem.java:103)
at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:95)
at TransferToHadoop.TransferFiles.<init>(TransferFiles.java:50)             
at.TransferToHadoop.ScheduleTransferJobs.getTransferFiles(ScheduleTransferJobs.java:99)
at .TransferToHadoop.ScheduleTransferJobs.main(ScheduleTransferJobs.java:30)
 Caused by: java.net.URISyntaxException: Illegal character in authority at index 7: hdfs://localhost:9000  
at java.net.URI$Parser.fail(URI.java:2809)
at java.net.URI$Parser.parseAuthority(URI.java:3147)
at java.net.URI$Parser.parseHierarchical(URI.java:3058)
at java.net.URI$Parser.parse(URI.java:3014)
at java.net.URI.<init>(URI.java:578)
at java.net.URI.create(URI.java:840)
... 5 more

I am trying to connect to hdfs.

Configuration configuration = new Configuration();
configuration.set("fs.default.name", this.hdfsHost);
fs = FileSystem.get(configuration);

hdfsHost is 127.0.0.1:9000.

but get this exception at FileSystem.get();

I have another project running the same code, but works well.
Could anyone give any suggestion?
Thank you very much

the exception track:

Exception in thread "main" java.lang.IllegalArgumentException
at java.net.URI.create(URI.java:842)
at org.apache.hadoop.fs.FileSystem.getDefaultUri(FileSystem.java:103)
at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:95)
at TransferToHadoop.TransferFiles.<init>(TransferFiles.java:50)             
at.TransferToHadoop.ScheduleTransferJobs.getTransferFiles(ScheduleTransferJobs.java:99)
at .TransferToHadoop.ScheduleTransferJobs.main(ScheduleTransferJobs.java:30)
 Caused by: java.net.URISyntaxException: Illegal character in authority at index 7: hdfs://localhost:9000  
at java.net.URI$Parser.fail(URI.java:2809)
at java.net.URI$Parser.parseAuthority(URI.java:3147)
at java.net.URI$Parser.parseHierarchical(URI.java:3058)
at java.net.URI$Parser.parse(URI.java:3014)
at java.net.URI.<init>(URI.java:578)
at java.net.URI.create(URI.java:840)
... 5 more

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

一梦等七年七年为一梦 2024-12-28 06:40:17

尝试将 hdfsHost 作为合格的 url hdfs://127.0.0.1:9000 而不是 127.0.0.1:9000 传递

Try passing hdfsHost as a qualified url hdfs://127.0.0.1:9000 instead of 127.0.0.1:9000

围归者 2024-12-28 06:40:17

如果 core-site.xml 中 hdfs 名称 (fs.defaultFS) 的属性值存在尾随空格,则可能会发生这种情况。

This can happen if there is trailing space in the core-site.xml against the property value for hdfs name (fs.defaultFS).

梦与时光遇 2024-12-28 06:40:17

在 /etc/hosts 文件中将主机名与两个服务器(即客户端和服务器)中相应的 ip 绑定

Bind the host name with the corresponding ip in both the servers i.e. in both client and server in /etc/hosts file

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文