本文介绍了索引7中的权限非法字符:hdfs:// localhost:9000 with hadoop的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

hdfsHost是127.0.0.1:9000。





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



异常追踪:

 线程main中的异常java.lang.IllegalArgumentException在java.net.URI.create处使用
(URI.java:842)在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)
导致:java.net.URISyntaxException:权限中的非法字符在索引7处:java.net.URI处的hdfs:// localhost:9000
$ java.net.URI处的
$ Parser.fail(URI.java:2809)$ Parser.parseAuthority(URI.java :3147)在java.net.URI
$ Parser.parseHierarchical(URI.java:3058)$ b $在java.net.URI $ Parser.parse(URI.java:3014)
at java.net.URI。< init>(URI.java:578)在java.net.URI.creat处
e(URI.java:840)
... 5 more


解决方案

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


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
解决方案

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

这篇关于索引7中的权限非法字符:hdfs:// localhost:9000 with hadoop的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 08:36