<?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: java.lang.NoClassDefFoundError: org/json/simple/JSONValue inside map partition in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/java-lang-NoClassDefFoundError-org-json-simple-JSONValue/m-p/23764#M4640</link>
    <description>&lt;P&gt;Is this library bundled with your app? One guess would be that it is not, and happens to be on the classpath from another dependency on the driver, but is not accidentally found on the executors.&lt;/P&gt;</description>
    <pubDate>Fri, 16 Jan 2015 03:53:39 GMT</pubDate>
    <dc:creator>srowen</dc:creator>
    <dc:date>2015-01-16T03:53:39Z</dc:date>
    <item>
      <title>java.lang.NoClassDefFoundError: org/json/simple/JSONValue inside map partition</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/java-lang-NoClassDefFoundError-org-json-simple-JSONValue/m-p/23761#M4639</link>
      <description>&lt;P&gt;Here is a snippet of the code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;object SparkCSVParser {&lt;/P&gt;&lt;P&gt;def main(args: Array[String]) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; val sc = new SparkContext(new SparkConf().setAppName("Spark Count"))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; val restClient = Client.create()&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; val webResource = restClient.resource(tsd)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;// JSONValue works outside of map partition, class is found&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;tokenized.mapPartitions(lines =&amp;gt; {&lt;BR /&gt;val parser = new CSVParser(',')&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; lines.map( line =&amp;gt; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; import org.json.simple.JSONValue&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; val columns = parser.parseLine(line)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var sensorMetrics = ArrayBuffer[String]()&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;for ((sName, sValuePos) &amp;lt;- nameToPos) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; val json = ("metric" -&amp;gt; sName) ~&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ("timestamp" -&amp;gt; (hoursInSec * columns(otherNameToPos("HOURS")).toInt).+(today / toSeconds - dayInSec)) ~&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ("value" -&amp;gt; columns(sValuePos)) ~&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ("tags" -&amp;gt; Map {"engine_index" -&amp;gt; columns(otherNameToPos("ENGINE_INDEX"))})&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sensorMetrics += pretty(json)&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; JSONValue.toJSONString(sensorMetrics) // &amp;lt;- it does not work here. Class is nor found&lt;BR /&gt;})&lt;BR /&gt;}).take(10).foreach(&lt;BR /&gt;webResource&lt;BR /&gt;.accept(MediaType.APPLICATION_JSON_TYPE)&lt;BR /&gt;.`type`(MediaType.APPLICATION_FORM_URLENCODED_TYPE)&lt;BR /&gt;.post(classOf[ClientResponse], _))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;running on "--master local"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the error:&lt;/P&gt;&lt;P&gt;15/01/15 21:43:35 WARN TaskSetManager: Lost task 0.0 in stage 0.0 (TID 0, localhost): java.lang.NoClassDefFoundError: org/json/simple/JSONValue&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;at com.decisioniq.spark.SparkTrainCSVParser$$anonfun$main$1$$anonfun$apply$1.apply(SparkTrainCSVParser.scala:136)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;at com.decisioniq.spark.SparkTrainCSVParser$$anonfun$main$1$$anonfun$apply$1.apply(SparkTrainCSVParser.scala:119)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;at scala.collection.Iterator$$anon$11.next(Iterator.scala:328)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;at scala.collection.Iterator$$anon$10.next(Iterator.scala:312)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;at scala.collection.Iterator$class.foreach(Iterator.scala:727)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I make it discover this class?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 09:19:22 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/java-lang-NoClassDefFoundError-org-json-simple-JSONValue/m-p/23761#M4639</guid>
      <dc:creator>gmortiz17</dc:creator>
      <dc:date>2022-09-16T09:19:22Z</dc:date>
    </item>
    <item>
      <title>Re: java.lang.NoClassDefFoundError: org/json/simple/JSONValue inside map partition</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/java-lang-NoClassDefFoundError-org-json-simple-JSONValue/m-p/23764#M4640</link>
      <description>&lt;P&gt;Is this library bundled with your app? One guess would be that it is not, and happens to be on the classpath from another dependency on the driver, but is not accidentally found on the executors.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jan 2015 03:53:39 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/java-lang-NoClassDefFoundError-org-json-simple-JSONValue/m-p/23764#M4640</guid>
      <dc:creator>srowen</dc:creator>
      <dc:date>2015-01-16T03:53:39Z</dc:date>
    </item>
    <item>
      <title>Re: java.lang.NoClassDefFoundError: org/json/simple/JSONValue inside map partition</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/java-lang-NoClassDefFoundError-org-json-simple-JSONValue/m-p/23765#M4641</link>
      <description>Actually, It doesn't work anywhere. I had tested it working within the IDE now when I packaged it up and sent it to the node it did not work even outside the map partition. NVM must be a packaging error</description>
      <pubDate>Fri, 16 Jan 2015 03:55:23 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/java-lang-NoClassDefFoundError-org-json-simple-JSONValue/m-p/23765#M4641</guid>
      <dc:creator>gmortiz17</dc:creator>
      <dc:date>2015-01-16T03:55:23Z</dc:date>
    </item>
    <item>
      <title>Re: java.lang.NoClassDefFoundError: org/json/simple/JSONValue inside map partition</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/java-lang-NoClassDefFoundError-org-json-simple-JSONValue/m-p/24017#M4642</link>
      <description>&lt;P&gt;The problem was indeed in the packaging. I fixed it by including the maven-assembly-plugin.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;lt;plugin&amp;gt;
                &amp;lt;artifactId&amp;gt;maven-assembly-plugin&amp;lt;/artifactId&amp;gt;
                &amp;lt;version&amp;gt;2.5.3&amp;lt;/version&amp;gt;
                &amp;lt;configuration&amp;gt;
                    &amp;lt;descriptorRefs&amp;gt;
                        &amp;lt;descriptorRef&amp;gt;jar-with-dependencies&amp;lt;/descriptorRef&amp;gt;
                    &amp;lt;/descriptorRefs&amp;gt;
                &amp;lt;/configuration&amp;gt;
                &amp;lt;executions&amp;gt;
                    &amp;lt;execution&amp;gt;
                        &amp;lt;id&amp;gt;make-assembly&amp;lt;/id&amp;gt; &amp;lt;!-- this is used for inheritance merges --&amp;gt;
                        &amp;lt;phase&amp;gt;package&amp;lt;/phase&amp;gt;
                        &amp;lt;goals&amp;gt;
                            &amp;lt;goal&amp;gt;single&amp;lt;/goal&amp;gt;
                        &amp;lt;/goals&amp;gt;
                    &amp;lt;/execution&amp;gt;
                &amp;lt;/executions&amp;gt;
            &amp;lt;/plugin&amp;gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jan 2015 19:14:00 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/java-lang-NoClassDefFoundError-org-json-simple-JSONValue/m-p/24017#M4642</guid>
      <dc:creator>gmortiz17</dc:creator>
      <dc:date>2015-01-23T19:14:00Z</dc:date>
    </item>
  </channel>
</rss>

