I have used hadoop 0.18.3 previously and shifted to version 0.20.2. I have setup hadoop in a pseudo distributed mode and then tried running the wordcount program available here. I have followed the instructions for compiling and running. But, I got the following errors on running.
java.lang.RuntimeException: java.lang.ClassNotFoundException: WordCount$Map
at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:809)
at org.apache.hadoop.mapreduce.JobContext.getMapperClass(JobContext.java:157)
at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:569)
at org.apache.hadoop.mapred.MapTask.run(MapTask.java:305)
at org.apache.hadoop.mapred.Child.main(Child.java:170)
Caused by: java.lang.ClassNotFoundException: WordCount$Map
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:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at org.apache.hadoop.conf.Configuration.getClassByName(Configuration.java:762)
at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:807)
I googled it and found that we need to add one line of code to rectify this problem. As the name of my program is WordCount, I have added the following line in the main of my class file.
job.setJarByClass(WordCount.class);
That fixed the error. So dont forget to add that line in your future programs.
Monday, December 27, 2010
Tuesday, December 8, 2009
Problems while Installing WordNet in Ubuntu
I tried installing Wordnet in Ubuntu and faced some problems. Prior to installing wordnet you need to install tcl and tk. When I ran make to install tcl I faced an error saying gcc is not able to create executables. To resolve this problem install build-essential
sudo apt-get install build-essential
Then the installation of tcl didn't pose any problems. But while installing tk I faced a make error which prevented installing of tk.
tk8.5.8/unix/../generic/tk.h:78:23: error: X11/Xlib.h: No such file or directory
To rectify this error I installed libx11-dev package using the command sudo apt-get install libx11-dev. After installing that package everything went fine.
sudo apt-get install build-essential
Then the installation of tcl didn't pose any problems. But while installing tk I faced a make error which prevented installing of tk.
tk8.5.8/unix/../generic/tk.h:78:23: error: X11/Xlib.h: No such file or directory
To rectify this error I installed libx11-dev package using the command sudo apt-get install libx11-dev. After installing that package everything went fine.
Thursday, October 29, 2009
Problem while upgrading from ubuntu 8.10 to 9.04
I upgraded my desktop from ubuntu 8.10 to 9.04. During this upgrade I got the following errors during the upgrade.
Setting up gnome-themes-selected (2.26.0-0ubuntu1) ...
gtk-update-icon-cache: No theme index file.dpkg: error processing gnome-themes-selected (--configure):
subprocess post-installation script returned error exit status 1
Errors were encountered while processing:
gnome-themes-selected
This occurred during the installation of the package gnome-themes-selected because of the missing of index.theme file in /usr/share/icons/Mist/ in my machine. I fixed it by copying the index file from another machine and running sudo apt-get install gnome-themes-selected
Setting up gnome-themes-selected (2.26.0-0ubuntu1) ...
gtk-update-icon-cache: No theme index file.dpkg: error processing gnome-themes-selected (--configure):
subprocess post-installation script returned error exit status 1
Errors were encountered while processing:
gnome-themes-selected
This occurred during the installation of the package gnome-themes-selected because of the missing of index.theme file in /usr/share/icons/Mist/ in my machine. I fixed it by copying the index file from another machine and running sudo apt-get install gnome-themes-selected
My First Post
This is my first post. I want to write about how I was able to rectify some of the problems while using ubuntu in my blog. I would be delighted if my solutions work for some others.
Subscribe to:
Comments (Atom)