hadoop2.4.0 namenode -format showing NoClassDefFoundError error - java

I have configured and install the HADOOP
I configured from the website http://www.srccodes.com/p/article/38/build-install-configure-run-apache-hadoop-2.2.0-microsoft-windows-os
when I format the hadoop namenode using the command
alim#Hadoop~/hadoop-2.4.0/bin$ ./hdfs namenode -format or alim#Hadoop~/hadoop-2.4.0/bin$ ./hadoop namenode -format
It is showing the "NoClassDefFoundError" exception
The following is the exception shown when I ran the "hadoop namenode -format" command
java.lang.NoClassDefFoundError: org/apache/hadoop/hdfs/server/namenode/NameNode
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.hdfs.server.namenode.NameNode
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: org.apache.hadoop.hdfs.server.namenode.NameNode. Program will exit.
Exception in thread "main"
At first i thought the hadoop classpath is the not pointing to the Hadoop-core jar files but when I ran the command alim#Hadoop~/hadoop-2.4.0/bin$ ./hadoop classpath It is showing the correct path to libraries then why the NoClassDefFoundError is gettingThe path to libraries are showing like below:
/home/alim/hadoop-2.4.0/etc/hadoop:/home/alim/hadoop-2.4.0/share/hadoop/common/lib/:/home/alim/hadoop-2.4.0/share/hadoop/common/:/home/alim/hadoop-2.4.0/share/hadoop/hdfs:/home/alim/hadoop-2.4.0/share/hadoop/hdfs/lib/:/home/alim/hadoop-2.4.0/share/hadoop/hdfs/:/home/alim/hadoop-2.4.0/share/hadoop/yarn/lib/:/home/alim/hadoop-2.4.0/share/hadoop/yarn/:/home/alim/hadoop-2.4.0/share/hadoop/mapreduce/lib/:/home/alim/hadoop-2.4.0/share/hadoop/mapreduce/:C:\cygwin64\home\alim\hadoop-2.4.0/contrib/capacity-scheduler/*.jar
please help I am beginner to Hadoop.... Any ideas

Related

java.lang.ClassNotFoundException when trying to run camus

I downloaded the confluent package which includes camus jars and I followed the instructions online enter link description here.
Hadoop is properly setup (meaning I can use hadoop fs -ls commands and other hadoop jar commands). However, when i tried to run
hadoop jar confluent-camus-1.0.jar com.linkedin.camus.etl.kafka.CamusJob
I got "main" classNotFound error
Exception in thread "main" java.lang.ClassNotFoundException: com.linkedin.camus.
etl.kafka.CamusJob
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:344)
at org.apache.hadoop.util.RunJar.main(RunJar.java:205)
The the path to the "confluent-camus-1.0.jar" is correct (right under the folder). I didn't start the kafka service, just to try to run it.
Anyone got similar problems?
Thanks.
You should try to inspect your jar file:
jar tvf confluent-camus-1.0.jar | grep com.linkedin.camus.etl.kafka.CamusJob
If you do not find this class, try to find it in other jar, which generated by camus.
After you should add target jar with
hadoop jar confluent-camus-1.0.jar com.linkedin.camus.etl.kafka.CamusJob -libjars {JAR_NAME}

HADOOP :: java.lang.ClassNotFoundException: WordCount

I am using eclipse to export the jar file of a map-reduce program. When i am run the jar using command
hadoop jar hadoop-prog.jar WordCount /home/temp/input /home/temp/output
it always shows the error :
Exception in thread "main" java.lang.ClassNotFoundException: WordCount
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at org.apache.hadoop.util.RunJar.main(RunJar.java:149)
Btw, I get a sample example jar file of wordcount from internet and it ran very well.
I could not figure out where is the problem.
If you're trying to run the wordcount provided in the examples, you should run:
hadoop jar hadoop*examples*.jar wordcount /home/temp/input /home/temp/output
More info on how to run wordcount on this link.
In general, if you're developing your own Map/Reduce jobs, you should include the full package name of your driver class, so something like this might work:
hadoop jar wordcount.jar com.something.WordCount /home/temp/input /home/temp/output

History Server not starting on cloudera Hadoop

I have setup the 'hadoop' by following the instructions given in here.
I downloaded and deployed it successfully and can able to run all the daemons except historyserver and run the example programs.
when I run sbin/yarn-daemon.sh start historyserver, the following error is displayed.
Exception in thread "main" java.lang.NoClassDefFoundError: historyserver
Caused by: java.lang.ClassNotFoundException: historyserver
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: historyserver. Program will exit.
Can anyone do help me in this issue?
To start the history server, it seems that the command is now:
./sbin/mr-jobhistory-daemon.sh start historyserver

Java error: java.lang.NoClassDefFoundError

I'm trying to to run my freshly installed apache solr on my server (CENTOS 5.2 x86_64) and I get the followoing error messages:
Exception in thread "main" java.lang.NoClassDefFoundError: start/jar
Caused by: java.lang.ClassNotFoundException: start.jar
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: start.jar. Program will exit.
This is the commend I ran: java start.jar
As far as I'm aware everything is installed correctly.
Any ideas?
Thanks
C
Run it with java -jar, not java:
java -jar start.jar
The java command is used for running .class files, while the java -jar command actually executes the code in the jar properly, using the manifest file to interpret the jar's contents.

How do I add a .jar file to the classpath on Mac OS X?

I'm starting to become pretty irritated, because EVERY time I try to add a JAR file to the classpath to run a program (which compiles fine in Eclipse) I get a "java.lang.NoClassDefFoundError" exception.
The file swt.jar and GUI.class (main class) are in the same directory. If I issue this command: "java -cp swt.jar GUI", I get this error message:
Exception in thread "main" java.lang.NoClassDefFoundError: GUI Caused
by: java.lang.ClassNotFoundException: GUI at
java.net.URLClassLoader$1.run(URLClassLoader.java:202) at
java.security.AccessController.doPrivileged(Native Method) at
java.net.URLClassLoader.findClass(URLClassLoader.java:190) at
java.lang.ClassLoader.loadClass(ClassLoader.java:306) at
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at
java.lang.ClassLoader.loadClass(ClassLoader.java:247)
If I formulate the command like this: "java GUI -cp swt.jar", it'll throw this exception:
Exception in thread "main" java.lang.NoClassDefFoundError:
org/eclipse/swt/widgets/Display at GUI.main(GUI.java:9) Caused by:
java.lang.ClassNotFoundException: org.eclipse.swt.widgets.Display at
java.net.URLClassLoader$1.run(URLClassLoader.java:202) at
java.security.AccessController.doPrivileged(Native Method) at
java.net.URLClassLoader.findClass(URLClassLoader.java:190) at
java.lang.ClassLoader.loadClass(ClassLoader.java:306) at
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at
java.lang.ClassLoader.loadClass(ClassLoader.java:247) ... 1 more
I just want to know how I can add .jar files to the runtime classpath on mac.
All of these commands are being issued from the Terminal on a 64-bit MacBook running Mac OS X Lion.
The problem, I think, is that you are specifying swt.jar as the classpath, but the file you're using is not in the jar. You neeed to specify both the jar and this dir as the classpath.
e.g.
java -cp swt.jar:./ GUI
This one will work, with modifications:
If I formulate the command like this: "java GUI -cp swt.jar"
You just didn't go far enough. You have to add ALL the 3rd party JARs, including the ones for Eclipse SWT and all your other dependencies.

Categories

Resources