java.net.UnknownHostException: hadoop

来源:3-17 HDFS API编程之第一个应用程序的开发

霸宋

2019-10-29

An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.apache.hadoop.security.authentication.util.KerberosUtil (file:/Users/andy/.m2/repository/org/apache/hadoop/hadoop-auth/2.6.0-cdh5.15.1/hadoop-auth-2.6.0-cdh5.15.1.jar) to method sun.security.krb5.Config.getInstance()
WARNING: Please consider reporting this to the maintainers of org.apache.hadoop.security.authentication.util.KerberosUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Exception in thread “main” java.lang.IllegalArgumentException: java.net.UnknownHostException: hadoop
at org.apache.hadoop.security.SecurityUtil.buildTokenService(SecurityUtil.java:406)
at org.apache.hadoop.hdfs.NameNodeProxies.createNonHAProxy(NameNodeProxies.java:310)
at org.apache.hadoop.hdfs.NameNodeProxies.createProxy(NameNodeProxies.java:176)
at org.apache.hadoop.hdfs.DFSClient.(DFSClient.java:763)
at org.apache.hadoop.hdfs.DFSClient.(DFSClient.java:694)
at org.apache.hadoop.hdfs.DistributedFileSystem.initialize(DistributedFileSystem.java:159)
at org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:2816)
at org.apache.hadoop.fs.FileSystem.access200(FileSystem.java:98)atorg.apache.hadoop.fs.FileSystem200(FileSystem.java:98) at org.apache.hadoop.fs.FileSystem200(FileSystem.java:98)atorg.apache.hadoop.fs.FileSystemCache.getInternal(FileSystem.java:2853)
at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:2835)
at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:387)
at org.apache.hadoop.fs.FileSystem$1.run(FileSystem.java:176)
at org.apache.hadoop.fs.FileSystem$1.run(FileSystem.java:173)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/javax.security.auth.Subject.doAs(Subject.java:423)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1924)
at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:173)
at com.imooc.bigdata.hadoop.hdfs.HDFSApp.main(HDFSApp.java:19)
Caused by: java.net.UnknownHostException: hadoop

出现了这个报错,去etc/hosts 看了 配置的都是对的
192.168.1.121 hadoop000
127.0.0.1 localhost

写回答

2回答

黑狗1209

2021-06-15

同学问题解决了嘛,确定Linux配置没有问题。看下宿主机的hosts映射是否更改了。刚刚踩过的坑,已经解决。

0
0

霸宋

提问者

2019-10-29

我 把 hadoop000改为ip地址192.168.1.121就可以了 。。很奇怪。。

0
2
Michael_PK
很明显你的报错信息是不识别hadoop,也就是hadoop和ip映射有问题
2019-10-29
共2条回复

Hadoop 系统入门+核心精讲

从Hadoop核心技术入手,掌握数据处理中ETL应用,轻松进军大数据

2397 学习 · 902 问题

查看课程