Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not find or load main class org.apache.hadoop.util.VersionInfo

Tags:

I followed "http://codesfusion.blogspot.com/2013/10/setup-hadoop-2x-220-on-ubuntu.html" to install hadoop on ubuntu. But, upon checking the hadoop version I get the following error:

Error: Could not find or load main class org.apache.hadoop.util.VersionInfo

Also, when I try: hdfs namenode -format

I get the following error:

Error: Could not find or load main class org.apache.hadoop.hdfs.server.namenode.NameNode

The java version used is:

java version "1.7.0_25" OpenJDK Runtime Environment (IcedTea 2.3.10) (7u25-2.3.10-1ubuntu0.12.04.2) OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode) 
like image 879
usb Avatar asked Jan 19 '14 02:01

usb


2 Answers

It is a problem of environmental variables setup. Apparently, I didnt find one which can work until NOW. I was trying on 2.6.4. Here is what we should do

export HADOOP_HOME=/home/centos/HADOOP/hadoop-2.6.4 export HADOOP_INSTALL=$HADOOP_HOME export HADOOP_MAPRED_HOME=$HADOOP_HOME export HADOOP_COMMON_HOME=$HADOOP_HOME export HADOOP_HDFS_HOME=$HADOOP_HOME export YARN_HOME=$HADOOP_HOME export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/native export PATH=$PATH:$HADOOP_HOME/sbin:$HADOOP_HOME/bin export HADOOP_CONF_DIR=$HADOOP_HOME export HADOOP_PREFIX=$HADOOP_HOME export HADOOP_LIBEXEC_DIR=$HADOOP_HOME/libexec export JAVA_LIBRARY_PATH=$HADOOP_HOME/lib/native:$JAVA_LIBRARY_PATH export HADOOP_CONF_DIR=$HADOOP_PREFIX/etc/hadoop 

Add these into your .bashrc and dont forget to do

source ~/.bashrc 

I think your problem will be solved as was mine.

like image 66
Somum Avatar answered Oct 24 '22 14:10

Somum


You probably did not follow the instructions correctly. Here are some things to try and help us / you diagnose this:

  • In the shell that you ran hadoop version, run export and show us the list of relevant environment variables.

  • Show us what you put in the /usr/local/hadoop/etc/hadoop/hadoop-env.sh file.

  • If neither of the above gives you / us any clues, then find and use a text editor to (temporarily) modify the hadoop wrapper shell script. Add the line "set -xv" somewhere near the beginning. Then run hadoop version, and show us what it produces.

like image 45
Stephen C Avatar answered Oct 24 '22 14:10

Stephen C