Hadoop的命令start-dfs.sh显示一个奇怪的错误

时间:2018-06-04 20:24:25

标签: java macos hadoop hdfs

当我尝试运行以下命令时,会弹出一个错误

Alis-Mac:hadoop-2.7.3 naziaimran $ sbin / start-dfs.sh

以下是错误,

2018-06-05 01:04:31.424 java[1879:21215] Unable to load realm info from SCDynamicStore
18/06/05 01:04:31 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Starting namenodes on [localhost]
localhost: starting namenode, logging to /Users/naziaimran/Desktop/hadoop-2.7.3/logs/hadoop-naziaimran-namenode-Alis-Mac.out
localhost: Exception in thread "main" java.lang.ExceptionInInitializerError
localhost:  at org.apache.hadoop.util.StringUtils.<clinit>(StringUtils.java:80)
localhost:  at org.apache.hadoop.hdfs.server.common.HdfsServerConstants$RollingUpgradeStartupOption.getAllOptionString(HdfsServerConstants.java:80)
localhost:  at org.apache.hadoop.hdfs.server.namenode.NameNode.<clinit>(NameNode.java:249)
localhost: Caused by: java.lang.StringIndexOutOfBoundsException: begin 0, end 3, length 2
localhost:  at java.base/java.lang.String.checkBoundsBeginEnd(String.java:3107)
localhost:  at java.base/java.lang.String.substring(String.java:1873)
localhost:  at org.apache.hadoop.util.Shell.<clinit>(Shell.java:51)
localhost:  ... 3 more
localhost: starting datanode, logging to /Users/naziaimran/Desktop/hadoop-2.7.3/logs/hadoop-naziaimran-datanode-Alis-Mac.out
Starting secondary namenodes [0.0.0.0]
0.0.0.0: starting secondarynamenode, logging to /Users/naziaimran/Desktop/hadoop-2.7.3/logs/hadoop-naziaimran-secondarynamenode-Alis-Mac.out
0.0.0.0: Exception in thread "main" java.lang.ExceptionInInitializerError
0.0.0.0:    at org.apache.hadoop.util.StringUtils.<clinit>(StringUtils.java:80)
0.0.0.0:    at org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode.main(SecondaryNameNode.java:667)
0.0.0.0: Caused by: java.lang.StringIndexOutOfBoundsException: begin 0, end 3, length 2
0.0.0.0:    at java.base/java.lang.String.checkBoundsBeginEnd(String.java:3107)
0.0.0.0:    at java.base/java.lang.String.substring(String.java:1873)
0.0.0.0:    at org.apache.hadoop.util.Shell.<clinit>(Shell.java:51)
0.0.0.0:    ... 2 more
2018-06-05 01:04:48.170 java[2203:22211] Unable to load realm info from SCDynamicStore
18/06/05 01:04:48 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable

我被困在这里好几天了,任何帮助都将受到高度赞赏。 在此先感谢:)

1 个答案:

答案 0 :(得分:1)

问题是Hadoop 2.7与Java 9/10不兼容。 我遇到了同样的问题,并通过降级到Java 8解决了这个问题。

如果不确定如何降级并使其正常工作,请在此处通过VK321检查答案: https://stackoverflow.com/a/48422257/5181904