<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Add third-party lib to MapReduce job Error: java.lang.ClassNotFoundException: org.json.JSONObject in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Add-third-party-lib-to-MapReduce-job-Error-java-lang/m-p/119425#M82203</link>
    <description>&lt;P&gt;I have tried 20160212 and 20090211, and only got it working for Distributed cache. I got the jar from below link:&lt;/P&gt;&lt;P&gt;&lt;A href="https://mvnrepository.com/artifact/org.json/json" target="_blank"&gt;https://mvnrepository.com/artifact/org.json/json&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Below is my command. How do I use -libjars? &lt;/P&gt;&lt;P&gt;hadoop jar driver-collection-1.0-SNAPSHOT.jar multipleoutputjson /test/inputjson/json_input.txt /test/outputjs&lt;/P&gt;&lt;P&gt;Thank you for your reply.&lt;/P&gt;</description>
    <pubDate>Sat, 09 Jul 2016 09:28:26 GMT</pubDate>
    <dc:creator>Howchoy</dc:creator>
    <dc:date>2016-07-09T09:28:26Z</dc:date>
    <item>
      <title>Add third-party lib to MapReduce job Error: java.lang.ClassNotFoundException: org.json.JSONObject</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Add-third-party-lib-to-MapReduce-job-Error-java-lang/m-p/119422#M82200</link>
      <description>&lt;P&gt;Command to submit the job: &lt;/P&gt;&lt;PRE&gt;hadoop jar driver-collection-1.0-SNAPSHOT.jar multipleoutputjson /test/inputjson/json_input.txt /test/outputjson &lt;/PRE&gt;&lt;P&gt;Error: java.lang.ClassNotFoundException: org.json.JSONObject, see attached.&lt;A href="https://community.cloudera.com/legacyfs/online/attachments/5610-error-message.txt"&gt;error-message.txt&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I have below dependency for org.json.JSONObject (filename: json-20160212.jar) in pom.xml: &lt;/P&gt;&lt;PRE&gt;&amp;lt;dependency&amp;gt; 
&amp;lt;groupId&amp;gt;org.json&amp;lt;/groupId&amp;gt; 
&amp;lt;artifactId&amp;gt;json&amp;lt;/artifactId&amp;gt; 
&amp;lt;version&amp;gt;20160212&amp;lt;/version&amp;gt; 
&amp;lt;scope&amp;gt;compile&amp;lt;/scope&amp;gt; 
&amp;lt;/dependency&amp;gt; &lt;/PRE&gt;&lt;P&gt;Code: The codes is pretty much like &lt;A href="http://hadooptutorial.info/mapreduce-multiple-outputs-use-case/ "&gt; this&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;I have tried the following links but in vain. Please advise your insight. &lt;/P&gt;&lt;UL&gt;
&lt;LI&gt;&lt;A href="https://hadoopi.wordpress.com/2014/06/05/hadoop-add-third-party-libraries-to-mapreduce-job/ "&gt; Hadoop: Add third-party libraries to MapReduce job &lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="http://blog.cloudera.com/blog/2011/01/how-to-include-third-party-libraries-in-your-map-reduce-job/ "&gt; How-to: Include Third-Party Libraries in Your MapReduce Job&lt;/A&gt; &lt;/LI&gt;&lt;LI&gt;&lt;A href="http://stackoverflow.com/questions/16340158/"&gt; Include Third Party Jars in Hadoop&lt;/A&gt; &lt;/LI&gt;&lt;LI&gt;&lt;A href="http://www.mkyong.com/maven/maven-create-a-fat-jar-file-one-jar-example/"&gt; include-third-party-jars-in-hadoop Maven – Create a fat Jar file – One-JAR example&lt;/A&gt; &lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Fri, 08 Jul 2016 05:51:46 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Add-third-party-lib-to-MapReduce-job-Error-java-lang/m-p/119422#M82200</guid>
      <dc:creator>Howchoy</dc:creator>
      <dc:date>2016-07-08T05:51:46Z</dc:date>
    </item>
    <item>
      <title>Re: Add third-party lib to MapReduce job Error: java.lang.ClassNotFoundException: org.json.JSONObject</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Add-third-party-lib-to-MapReduce-job-Error-java-lang/m-p/119423#M82201</link>
      <description>&lt;P&gt;I used the method - "Distributed cache" from "Hadoop: Add third-party libraries to MapReduce job" and got it working.&lt;/P&gt;&lt;P&gt;The following is my steps:&lt;/P&gt;&lt;UL&gt;
&lt;LI&gt;Copied json-20160212.jar to /user/root/lib/json-20160212.jar in hdfs.&lt;/LI&gt;&lt;LI&gt;Added the following codes in Driver class:&lt;UL&gt;
&lt;LI&gt;job.addCacheFile(new Path("/user/root/lib/json-20160212.jar").toUri());&lt;/LI&gt;&lt;LI&gt;job.setJarByClass(JSONObject.class);&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;Compiled the codes and ran the test.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Still very anxious to learn to solve it by using the following methods:&lt;/P&gt;&lt;UL&gt;
&lt;LI&gt;Add libjars option&lt;/LI&gt;&lt;LI&gt;Add jar files to Hadoop classpath&lt;/LI&gt;&lt;LI&gt;Create a fat jar&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2016 09:32:12 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Add-third-party-lib-to-MapReduce-job-Error-java-lang/m-p/119423#M82201</guid>
      <dc:creator>Howchoy</dc:creator>
      <dc:date>2016-07-08T09:32:12Z</dc:date>
    </item>
    <item>
      <title>Re: Add third-party lib to MapReduce job Error: java.lang.ClassNotFoundException: org.json.JSONObject</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Add-third-party-lib-to-MapReduce-job-Error-java-lang/m-p/119424#M82202</link>
      <description>&lt;A rel="user" href="https://community.cloudera.com/users/10154/charles138.html" nodeid="10154"&gt;@Charles Chen&lt;/A&gt;&lt;P&gt;I don't see an issue with your steps, what I remember from past experiences working with org.json is that some classes were refactored out and perhaps org.json.JSONOBject is not available in version 20160212 try earlier version like 20140107. This will create a fat jar, &amp;lt;scope&amp;gt; is optional as compile is default action. That or -libjars are viable options, let us know if you're still having issues, I'll try to help.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2016 10:16:00 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Add-third-party-lib-to-MapReduce-job-Error-java-lang/m-p/119424#M82202</guid>
      <dc:creator>aervits</dc:creator>
      <dc:date>2016-07-08T10:16:00Z</dc:date>
    </item>
    <item>
      <title>Re: Add third-party lib to MapReduce job Error: java.lang.ClassNotFoundException: org.json.JSONObject</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Add-third-party-lib-to-MapReduce-job-Error-java-lang/m-p/119425#M82203</link>
      <description>&lt;P&gt;I have tried 20160212 and 20090211, and only got it working for Distributed cache. I got the jar from below link:&lt;/P&gt;&lt;P&gt;&lt;A href="https://mvnrepository.com/artifact/org.json/json" target="_blank"&gt;https://mvnrepository.com/artifact/org.json/json&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Below is my command. How do I use -libjars? &lt;/P&gt;&lt;P&gt;hadoop jar driver-collection-1.0-SNAPSHOT.jar multipleoutputjson /test/inputjson/json_input.txt /test/outputjs&lt;/P&gt;&lt;P&gt;Thank you for your reply.&lt;/P&gt;</description>
      <pubDate>Sat, 09 Jul 2016 09:28:26 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Add-third-party-lib-to-MapReduce-job-Error-java-lang/m-p/119425#M82203</guid>
      <dc:creator>Howchoy</dc:creator>
      <dc:date>2016-07-09T09:28:26Z</dc:date>
    </item>
    <item>
      <title>Re: Add third-party lib to MapReduce job Error: java.lang.ClassNotFoundException: org.json.JSONObject</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Add-third-party-lib-to-MapReduce-job-Error-java-lang/m-p/119426#M82204</link>
      <description>&lt;P&gt;Please see this for example &lt;A href="https://dzone.com/articles/using-libjars-option-hadoop"&gt;https://dzone.com/articles/using-libjars-option-hadoop&lt;/A&gt;&lt;/P&gt;&lt;P&gt;And &lt;A href="http://stackoverflow.com/questions/6890087/problem-with-libjars-in-hadoop" target="_blank"&gt;http://stackoverflow.com/questions/6890087/problem-with-libjars-in-hadoop&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2016 16:04:25 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Add-third-party-lib-to-MapReduce-job-Error-java-lang/m-p/119426#M82204</guid>
      <dc:creator>aervits</dc:creator>
      <dc:date>2016-07-12T16:04:25Z</dc:date>
    </item>
  </channel>
</rss>

