当我尝试使用namenode和format参数执行hadoop命令时出现此错误。
C:\hadoop-2.5.2\bin>hadoop namenode -format
DEPRECATED: Use of this script to execute hdfs command is deprecated.
Instead use the hdfs command for it.
Error: Could not find or load main class org.apache.hadoop.hdfs.server.namenode.
NameNode
这是export命令的输出。所有这些变量都被声明为环境用户变量。
declare -x CLASSPATH="C:\\hadoop-2.5.2\\share\\hadoop\\common;C:\\Java\\jdk1.7.0_51\\bin;C:\\Java\\jdk1.7.0_51\\jre\\bin;"
declare -x JAVA_HOME="C:\\Java\\jdk1.7.0_51"
declare -x HADOOP_COMMON_HOME="C:\\hadoop-2.5.2"
declare -x HADOOP_HDFS_HOME="C:\\hadoop-2.5.2\\share\\hadoop\\hdfs"
declare -x HADOOP_PREFIX="C:\\hadoop-2.5.2\\bin\\hadoop"
declare -x HADOOP_YARN_HOME="C:\\hadoop-2.5.2\\share\\hadoop\\yarn"
C:\hadoop-2.5.2\bin>hadoop version
Hadoop 2.5.2
Subversion https://git-wip-us.apache.org/repos/asf/hadoop.git -r cc72e9b000545b8
6b75a61f4835eb86d57bfafc0
Compiled by jenkins on 2014-11-14T23:45Z
Compiled with protoc 2.5.0
From source with checksum df7537a4faa4658983d397abf4514320
This command was run using /C:/hadoop-2.5.2/share/hadoop/common/hadoop-common-2.
5.2.jar
当我运行hadoop classpath命令时,没有路径中有任何jar文件,这让我觉得这里有错误。任何人都可以告诉错误是否实际上与类路径?
env变量类路径具有直到具有jar文件的公共目录的路径。 hadoop类路径是否也应该被修改?如果是,我应该添加什么?
declare -x CLASSPATH="C:\\hadoop-2.5.2\\share\\hadoop\\common;C:\\Java\\jdk1.7.0_51\\bin;C:\\Java\\jdk1.7.0_51\\jre\\bin;"
C:\hadoop-2.5.2\bin>hadoop classpath
C:\hadoop-2.5.2\etc\hadoop;C:\hadoop-2.5.2\share\hadoop\common\lib\*;C:\hadoop-2
.5.2\share\hadoop\common\*;C:\hadoop-2.5.2\share\hadoop\hdfs\share\hadoop\hdfs\*
;C:\hadoop-2.5.2\share\hadoop\yarn\share\hadoop\yarn\*;C:\hadoop-2.5.2\share\had
oop\mapreduce\lib\*;C:\hadoop-2.5.2\share\hadoop\mapreduce\*
感谢您的帮助。请不要将其标记为重复,因为我花了很多时间通过这些线程而没有任何突破。
Could not find or load main class when trying to format namenode; hadoop installation on MAC OS X 10.9.2 Could not find or load main class org.apache.hadoop.hdfs.server.namenode.Namenode