Unable to format namenode. Main class not found - Updated the previous question with latest screenshots


Error stack trace is as below

hadoop@hadoop:/usr/local/hadoop/etc/hadoop$ hdfs namenode -format
Error: Could not find or load main class org.apache.hadoop.hdfs.server.namenode.NameNode

Have verified the configuration files too.

The error is consistent but multiple tries of installation of new VMs.

All the configuration find and bash file screen shots are attached.

Have also tried with core=site.xml having fs.default.name as the property instead of fs.defaultFS.


2 Answer(s)


Issue seems to be the missing Hadoop_home variable not being set. 

The document shared needs to be updated


As Apache hadoop not officially support Ubuntu Desktop version 16.04. This issue comes often.

It was a problem with following things which you need to check:

1. Ubuntu 16 (latest version)
2. Java was not updated
3. HADOOP_HOME, HADOOP_PREFIX were pointed towards old hadoop directory path which requires an update
4. CLASSPATH was not updated
Hope this helps.