<?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: Spark2 - Getting 'Could not find or load main class org.apache.spark.deploy.yarn.ApplicationMaster' Error when valid spark2-hdp-yarn-archive.tar.gz is present in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Spark2-Getting-Could-not-find-or-load-main-class-org-apache/m-p/207346#M68997</link>
    <description>&lt;P&gt;That file is needed only for performance reason. It works like a cache. Otherwise, you have to upload the jars everytime an application starts.&lt;/P&gt;&lt;P&gt;Your problem might be that you have a root folder in your tar.gz. In this case, if you list your files in the archive, you should see something like&lt;/P&gt;&lt;PRE&gt;./one.jar
./another.jar
...&lt;/PRE&gt;&lt;P&gt;Instead, you should have no root folder, and listing the files should be:&lt;/P&gt;&lt;PRE&gt;one.jar
another.jar
...&lt;/PRE&gt;&lt;P&gt;If this is the case, here you have some examples how to do it: &lt;A href="https://stackoverflow.com/questions/939982/how-do-i-tar-a-directory-of-files-and-folders-without-including-the-directory-it" target="_blank"&gt;https://stackoverflow.com/questions/939982/how-do-i-tar-a-directory-of-files-and-folders-without-including-the-directory-it&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
    <pubDate>Fri, 06 Oct 2017 14:57:39 GMT</pubDate>
    <dc:creator>mgaido1</dc:creator>
    <dc:date>2017-10-06T14:57:39Z</dc:date>
    <item>
      <title>Spark2 - Getting 'Could not find or load main class org.apache.spark.deploy.yarn.ApplicationMaster' Error when valid spark2-hdp-yarn-archive.tar.gz is present</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Spark2-Getting-Could-not-find-or-load-main-class-org-apache/m-p/207345#M68996</link>
      <description>&lt;P&gt;I was getting a zero-length error on /usr/hdp/apps/spark2/spark2-hdp-yarn-archive.tar.gz, which is documented as an issue
after some upgrades. So I created and uploaded the file to hdfs using the following commands: &lt;/P&gt;&lt;PRE&gt;tar -zcvf spark2-hdp-yarn-archive.tar.gz /usr/hdp/current/spark2-client/jars/* 
hadoop fs -put spark2-hdp-yarn-archive.tar.gz /hdp/apps/2.5.3.0-37/spark2/&lt;/PRE&gt;&lt;P&gt;Now when running any spark job in yarn (say the example pi app), I get the following error: &lt;/P&gt;&lt;PRE&gt;Error: 'Could not find or load main class org.apache.spark.deploy.yarn.ApplicationMaster' &lt;/PRE&gt;&lt;P&gt;Other info: &lt;/P&gt;&lt;UL&gt;&lt;LI&gt;This is HDP 2.5.3 Running Spark 2.1
Upgraded from HDP 2.2.8 -&amp;gt; 2.4.3 -&amp;gt; 2.5.3&lt;/LI&gt;&lt;LI&gt;I believe the missing class is in spark/lib/spark-hdp-assembly.jar, but this does not exist.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;HERE'S THE WEIRD PART &lt;/STRONG&gt;- If I completely remove the spark2-hdp-yarn-archive.tar.gz from HDFS then Spark jobs start to run again! &lt;/P&gt;&lt;P&gt;So, here are the questions:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Is this file (spark2-hdp-yarn-archive.tar.gz) needed?&lt;/LI&gt;&lt;LI&gt;If so, any direction on correcting this error.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Thu, 05 Oct 2017 05:25:25 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Spark2-Getting-Could-not-find-or-load-main-class-org-apache/m-p/207345#M68996</guid>
      <dc:creator>Jim_B</dc:creator>
      <dc:date>2017-10-05T05:25:25Z</dc:date>
    </item>
    <item>
      <title>Re: Spark2 - Getting 'Could not find or load main class org.apache.spark.deploy.yarn.ApplicationMaster' Error when valid spark2-hdp-yarn-archive.tar.gz is present</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Spark2-Getting-Could-not-find-or-load-main-class-org-apache/m-p/207346#M68997</link>
      <description>&lt;P&gt;That file is needed only for performance reason. It works like a cache. Otherwise, you have to upload the jars everytime an application starts.&lt;/P&gt;&lt;P&gt;Your problem might be that you have a root folder in your tar.gz. In this case, if you list your files in the archive, you should see something like&lt;/P&gt;&lt;PRE&gt;./one.jar
./another.jar
...&lt;/PRE&gt;&lt;P&gt;Instead, you should have no root folder, and listing the files should be:&lt;/P&gt;&lt;PRE&gt;one.jar
another.jar
...&lt;/PRE&gt;&lt;P&gt;If this is the case, here you have some examples how to do it: &lt;A href="https://stackoverflow.com/questions/939982/how-do-i-tar-a-directory-of-files-and-folders-without-including-the-directory-it" target="_blank"&gt;https://stackoverflow.com/questions/939982/how-do-i-tar-a-directory-of-files-and-folders-without-including-the-directory-it&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Oct 2017 14:57:39 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Spark2-Getting-Could-not-find-or-load-main-class-org-apache/m-p/207346#M68997</guid>
      <dc:creator>mgaido1</dc:creator>
      <dc:date>2017-10-06T14:57:39Z</dc:date>
    </item>
    <item>
      <title>Re: Spark2 - Getting 'Could not find or load main class org.apache.spark.deploy.yarn.ApplicationMaster' Error when valid spark2-hdp-yarn-archive.tar.gz is present</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Spark2-Getting-Could-not-find-or-load-main-class-org-apache/m-p/207347#M68998</link>
      <description>&lt;P&gt;Thanks! Very subtle difference, but obviously important to Spark! For everyone's reference, this tar command can be used to create a tar.gz with the jars in the root of the archive:&lt;/P&gt;&lt;PRE&gt;cd /usr/hdp/current/spark2-client/jars/
tar -zcvf /tmp/spark2-hdp-yarn-archive.tar.gz *

# List the files in the archive. Note that they are in the root!
tar -tvf /tmp/spark2-hdp-yarn-archive.tar.gz 
-rw-r--r-- root/root     69409 2016-11-30 03:31 activation-1.1.1.jar
-rw-r--r-- root/root    445288 2016-11-30 03:31 antlr-2.7.7.jar
-rw-r--r-- root/root    302248 2016-11-30 03:31 antlr4-runtime-4.5.3.jar
-rw-r--r-- root/root    164368 2016-11-30 03:31 antlr-runtime-3.4.jar
...
# Then upload to hdfs, fix ownership and permissions if needed, and good to go!&lt;/PRE&gt;</description>
      <pubDate>Sun, 08 Oct 2017 00:52:22 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Spark2-Getting-Could-not-find-or-load-main-class-org-apache/m-p/207347#M68998</guid>
      <dc:creator>Jim_B</dc:creator>
      <dc:date>2017-10-08T00:52:22Z</dc:date>
    </item>
  </channel>
</rss>

