hadoop - Mapper class not found -


sometimes mr job complains mymapper class in not found. , have give job.setjarbyclass(mymapper.class); tell load jar file.

cloudera@cloudera-vm:/tmp/translator$ hadoop jar mapreducejobs.jar translator/input/portuguese.txt translator/output 13/06/13 03:36:57 warn mapred.jobclient: no job jar file set. user classes may not found. see jobconf(class) or jobconf#setjar(string). 13/06/13 03:36:57 info input.fileinputformat: total input paths process : 1 13/06/13 03:36:57 info mapred.jobclient: running job: job_201305100422_0043 13/06/13 03:36:58 info mapred.jobclient: map 0% reduce 0% 13/06/13 03:37:03 info mapred.jobclient: task id : attempt_201305100422_0043_m_000000_0, status : failed java.lang.runtimeexception: java.lang.classnotfoundexception: com.mapreduce.variousformats.keyvaluetextinputformat.mymapper @ org.apache.hadoop.conf.configuration.getclass(configuration.java:996) @ org.apache.hadoop.mapreduce.jobcontext.getmapperclass(jobcontext.java:212) @ org.apache.hadoop.mapred.maptask.runnewmapper(maptask.java:601)

question : why happen. why doesn't tell me load jar file. there best practices tackling these kind of issues. if using 3rd party libraries , have them well.

be sure add dependencies both hadoop_classpath , -libjars upon submitting job in following examples:

use following add jar dependencies (for example) current , lib directories:

export hadoop_classpath=$hadoop_classpath:`echo *.jar`:`echo lib/*.jar | sed 's/ /:/g'` 

bear in mind when starting job through hadoop jar you'll need pass jars of dependencies through use of -libjars. use:

hadoop jar <jar> <class> -libjars `echo ./lib/*.jar | sed 's/ /,/g'` [args...] 

note: sed commands require different delimiter character; hadoop_classpath : separated , -libjars need , separated.


Comments