<?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: ClassNotFoundException when running a MapReduce job in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/ClassNotFoundException-when-running-a-MapReduce-job/m-p/7818#M1372</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Can you try adding "oozie.libpath=/application/lib" to your job.properties and see if that helps?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I added the "oozie.libpath" property to my job.properties files. &amp;nbsp;(In the format "hdfs://fqdn:8020/application/lib")&lt;/P&gt;&lt;P&gt;The MapReduce job ran successfully.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;However&lt;/EM&gt;, I had previously added local copies of my jars to the &lt;SPAN&gt;HADOOP_CLASSPATH using the&amp;nbsp;&lt;/SPAN&gt;"&lt;SPAN&gt;&lt;EM&gt;MapReduce Service Environment Safety Valve&lt;/EM&gt;" property in Cloudera Manager (ie HADOOP_CLASSPATH=/localpath/foo.jar:&lt;SPAN&gt;/localpath/bar.jar&lt;/SPAN&gt;) &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Upon removing this my MapReduce job failed with the same CNF error as before.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any ideas why I can only get this working with the jars on hdfs and the local file systems?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Surely I should only have the jars on hdfs?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks for yor help,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Andrew&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 25 Mar 2014 15:07:21 GMT</pubDate>
    <dc:creator>AndrewC</dc:creator>
    <dc:date>2014-03-25T15:07:21Z</dc:date>
    <item>
      <title>ClassNotFoundException when running a MapReduce job</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/ClassNotFoundException-when-running-a-MapReduce-job/m-p/7678#M1367</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm getting a ClassNotFoundException when running a MapReduce job using Oozie.&lt;BR /&gt;I'm using CDH4.2.1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The command I am using to start my job is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;oozie job -oozie http://localhost:11000/oozie -config job.properties -DstartDateTime=`date +%FT%RZ`&lt;/PRE&gt;&lt;P&gt;I have multiple jars which I am adding to the classpath using:&lt;/P&gt;&lt;PRE&gt;DistributedCache.addArchiveToClassPath()&lt;/PRE&gt;&lt;P&gt;However, these jars do no appear to be on the classpath of my MapReduce job.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have two workarounds&lt;BR /&gt;1. Using the 'hadoop jar -libjars' command.&lt;BR /&gt;2. If I package all the jars as a jar-with-dependencies. I suspect that this works because the jar-with-dependencies is getting added to the classpath by job.setJarByClass(). This would imply that there is a problem with the DistributedCache.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone have any ideas how I can get this working through Oozie with multiple jars?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;BR /&gt;Andrew&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 08:55:51 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/ClassNotFoundException-when-running-a-MapReduce-job/m-p/7678#M1367</guid>
      <dc:creator>AndrewC</dc:creator>
      <dc:date>2022-09-16T08:55:51Z</dc:date>
    </item>
    <item>
      <title>Re: ClassNotFoundException when running a MapReduce job</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/ClassNotFoundException-when-running-a-MapReduce-job/m-p/7680#M1368</link>
      <description>&lt;P&gt;Hey Andrew,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Where are you storing the jars that you need in the distributed cache? &amp;nbsp;Are they in the "${oozie.wf.application.path}/lib" or another location in HDFS?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Fri, 21 Mar 2014 16:21:30 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/ClassNotFoundException-when-running-a-MapReduce-job/m-p/7680#M1368</guid>
      <dc:creator>cconner</dc:creator>
      <dc:date>2014-03-21T16:21:30Z</dc:date>
    </item>
    <item>
      <title>Re: ClassNotFoundException when running a MapReduce job</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/ClassNotFoundException-when-running-a-MapReduce-job/m-p/7682#M1369</link>
      <description>&lt;P&gt;Also, you're not trying to access HBase from the MR job, are you? &amp;nbsp;Which class are you getting the CNF exception on?&lt;/P&gt;</description>
      <pubDate>Fri, 21 Mar 2014 16:23:55 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/ClassNotFoundException-when-running-a-MapReduce-job/m-p/7682#M1369</guid>
      <dc:creator>Clint</dc:creator>
      <dc:date>2014-03-21T16:23:55Z</dc:date>
    </item>
    <item>
      <title>Re: ClassNotFoundException when running a MapReduce job</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/ClassNotFoundException-when-running-a-MapReduce-job/m-p/7686#M1370</link>
      <description>&lt;P&gt;Thankyou for the responses.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Where are you storing the jars that you need in the distributed cache?&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;The jars are stored on hdfs under "/application/lib"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Are they in the "${oozie.wf.application.path}/lib" or another location in HDFS?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I'm using &lt;SPAN&gt;${oozie.coord.application.path} in my job.properties file.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11px;"&gt;If I use&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="font-size: 11px;"&gt;${oozie.wf.application.path} instead then I get a CNF error because it can't find my&amp;nbsp;ToolRunner class.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11px;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11px;"&gt;Should I be using&amp;nbsp;&lt;SPAN&gt;${oozie.wf.application.path} but adding my ToolRunner class to the HADOOP_CLASSPATH?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11px;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="font-size: 11px;"&gt;Also, you're not trying to access HBase from the MR job, are you? &amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I'm not using HBase. &amp;nbsp;The MapReduce job ingests into Accumulo.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Which class are you getting the CNF exception on?&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The CNF exception is on a class within one of my jar files. &amp;nbsp;It's the super class of my Mapper.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11px;"&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11px;"&gt;&lt;SPAN&gt;Andrew&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11px;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11px;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11px;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Mar 2014 16:58:14 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/ClassNotFoundException-when-running-a-MapReduce-job/m-p/7686#M1370</guid>
      <dc:creator>AndrewC</dc:creator>
      <dc:date>2014-03-21T16:58:14Z</dc:date>
    </item>
    <item>
      <title>Re: ClassNotFoundException when running a MapReduce job</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/ClassNotFoundException-when-running-a-MapReduce-job/m-p/7694#M1371</link>
      <description>&lt;P&gt;Hey Andrew,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you try adding "oozie.libpath=/application/lib" to your job.properties and see if that helps?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Fri, 21 Mar 2014 18:41:43 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/ClassNotFoundException-when-running-a-MapReduce-job/m-p/7694#M1371</guid>
      <dc:creator>cconner</dc:creator>
      <dc:date>2014-03-21T18:41:43Z</dc:date>
    </item>
    <item>
      <title>Re: ClassNotFoundException when running a MapReduce job</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/ClassNotFoundException-when-running-a-MapReduce-job/m-p/7818#M1372</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Can you try adding "oozie.libpath=/application/lib" to your job.properties and see if that helps?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I added the "oozie.libpath" property to my job.properties files. &amp;nbsp;(In the format "hdfs://fqdn:8020/application/lib")&lt;/P&gt;&lt;P&gt;The MapReduce job ran successfully.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;However&lt;/EM&gt;, I had previously added local copies of my jars to the &lt;SPAN&gt;HADOOP_CLASSPATH using the&amp;nbsp;&lt;/SPAN&gt;"&lt;SPAN&gt;&lt;EM&gt;MapReduce Service Environment Safety Valve&lt;/EM&gt;" property in Cloudera Manager (ie HADOOP_CLASSPATH=/localpath/foo.jar:&lt;SPAN&gt;/localpath/bar.jar&lt;/SPAN&gt;) &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Upon removing this my MapReduce job failed with the same CNF error as before.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any ideas why I can only get this working with the jars on hdfs and the local file systems?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Surely I should only have the jars on hdfs?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks for yor help,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Andrew&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Mar 2014 15:07:21 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/ClassNotFoundException-when-running-a-MapReduce-job/m-p/7818#M1372</guid>
      <dc:creator>AndrewC</dc:creator>
      <dc:date>2014-03-25T15:07:21Z</dc:date>
    </item>
    <item>
      <title>Re: ClassNotFoundException when running a MapReduce job</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/ClassNotFoundException-when-running-a-MapReduce-job/m-p/8242#M1373</link>
      <description>&lt;P&gt;Hi just to follow up on this, I have now solved the problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There were two things that I needed to do:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1.&amp;nbsp;&lt;SPAN style="font-size: 11px; line-height: 1.2;"&gt;In addition to adding &lt;FONT face="courier new,courier"&gt;oozie.libpath&lt;/FONT&gt; to my &lt;FONT face="courier new,courier"&gt;job.properties&lt;/FONT&gt;, &amp;nbsp;I also needed to include&amp;nbsp;&lt;FONT face="courier new,courier"&gt;oozie.use.system.libpath=true&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. Before I was using the following line to add files to the DistributedCache:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11px; line-height: 1.2;"&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;FileStatus[] status = fs.listStatus("/application/lib");
&lt;BR /&gt;if (status != null) {
    for (int i = 0; i &amp;lt; status.length; ++i) {
        if (!status[i].isDir()) {
            DistributedCache.addFileToClassPath(status[i].getPath(), job.getConfiguration(), fs);
        }
    }
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This appeared to be causing a classpath issue because it was adding &lt;FONT face="courier new,courier"&gt;hdfs://hostname&lt;/FONT&gt; before the hdfs path.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now I am using the following to remove that and only add the absolute hdfs path:&lt;/P&gt;&lt;PRE&gt;FileStatus[] status = fs.listStatus("/application/lib");

if (status != null) {
    for (int i = 0; i &amp;lt; status.length; ++i) {
        if (!status[i].isDir()) {&lt;BR /&gt;            Path distCachePath = new Path(status[i].getPath().toUri().getPath());
            DistributedCache.addFileToClassPath(distCachePath, job.getConfiguration(), fs);
        }
    }
} &lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thankyou to those that replied to my original query for pointing me in the right direction.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Andrew&lt;/P&gt;</description>
      <pubDate>Tue, 01 Apr 2014 09:59:36 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/ClassNotFoundException-when-running-a-MapReduce-job/m-p/8242#M1373</guid>
      <dc:creator>AndrewC</dc:creator>
      <dc:date>2014-04-01T09:59:36Z</dc:date>
    </item>
  </channel>
</rss>

