索引 7 处的权限非法字符:hdfs://localhost:9000 与 hadoop
我正在尝试连接到 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
尝试将 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
如果 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).
在 /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