java - Why do we set hadoop_classpath for folder conatining the jar is required to run? -
i trying run wordcount program. created wordcount.jar. below content of jar.
meta-inf/<br> meta-inf/manifest.mf<br> org/myorg/wordcount.class<br> org/myorg/wordcount$intsumreducer.class<br> org/myorg/wordcount$tokenizermapper.class<br>
i ran program using below command:
hadoop jar ./wordcount.jar org.myorg. wordcount mreduce/input mreduce/output
however getting below error:
java.lang.runtimeexception: java.lang.classnotfoundexception: class org.myorg.wordcount$tokenizermapper not found @ org.apache.hadoop.conf.configuration.getclass(configuration.java:1895) @ org.apache.hadoop.mapreduce.task.jobcontextimpl.getmapperclass(jobcontextimpl.java:191) @ org.apache.hadoop.mapred.maptask.runnewmapper(maptask.java:631) @ org.apache.hadoop.mapred.maptask.run(maptask.java:330) @ org.apache.hadoop.mapred.child$4.run(child.java:268)
but used export hadoop_classpath=<folder jar present>
and issue resolved. can please explain this?
this more of configuration question rather hadoop question. wordcount java code, needs hadoop jars , mapreduce jars(mostly client ones). when running word count jar, code needs reference of hadoop jars , @ hadoop_classpath directory. thats reason able run once path set.
you system should have classpath set env variable.
alternatively, can include required jars inside wordcount jar itself(fat jar).
Comments
Post a Comment