Home:ALL Converter>Cannot run Java class files with hadoop streaming

Cannot run Java class files with hadoop streaming

Ask Time:2011-07-23T01:35:04         Author:Shrish Bajpai

Json Formatter

Whenever I am trying to use Java class files as my mapper and/or reducer I am getting the following error:

java.io.IOException: Cannot run program "MapperTst.class": java.io.IOException: error=2, No such file or directory

I executed the following command on the terminal:

hadoop@ubuntu:/usr/local/hadoop$ bin/hadoop jar contrib/streaming/hadoop-streaming-0.20.203.0.jar -file /home/hadoop/codes/MapperTst.class -mapper /home/hadoop/codes/MapperTst.class -file /home/hadoop/codes/ReducerTst.class -reducer /home/hadoop/codes/ReducerTst.class  -input gutenberg/* -output gutenberg-outputtstch27

Author:Shrish Bajpai,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/6793856/cannot-run-java-class-files-with-hadoop-streaming
surfer :

I had the same problem. The solution was for me to put the java mapper/reducer/combiner in a specified package. With the default package it won't work. It will give you the error you had.",
2011-12-19T13:32:23
arun_suresh :

Assuming your fully qualified Mapper class name (including the package) is codes.MapperTest and the reducer class name is codes.ReducerTst,\n\nPackage your Map and reduce classes into a jar file say /home/hadoop/test.jar\nYour command should work if you modify it to :\n\n\nhadoop@ubuntu:/usr/local/hadoop$ bin/hadoop jar \\\n contrib/streaming/hadoop-streaming-0.20.203.0.jar \\\n -libjars /home/hadoop/test.jar \\\n -mapper codes.MapperTst \\\n -reducer codes.ReducerTst \\\n -input gutenberg/* -output gutenberg-outputtstch27\n",
2011-07-26T19:46:26
yy