<?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: Error: Exception in thread &amp;quot;main&amp;quot; java.lang.NoSuchMethodError: org.apache.curator.utils.PathUtils.validatePath(Ljava/lang/String;)Ljava/lang/String; in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Error-Exception-in-thread-quot-main-quot-java-lang/m-p/208058#M79078</link>
    <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/11048/falbani.html" nodeid="11048"&gt;@Felix Albani&lt;/A&gt; thank you for your answer, spark-shell in your sample works because it uses embedded PathUtils artifact:&lt;/P&gt;&lt;PRE&gt;scala&amp;gt; classOf[PathUtils].getProtectionDomain().getCodeSource().getLocation()
res1: java.net.URL = file:/usr/hdp/2.6.4.0-91/spark/lib/spark-assembly-1.6.3.2.6.4.0-91-hadoop2.7.3.2.6.4.0-91.jar&amp;lt;br&amp;gt;&lt;/PRE&gt;&lt;P&gt;In my sample I have only one dependency, so the issue can't be caused by the fat jar.&lt;/P&gt;&lt;P&gt;Using --jars curator-client-2.7.1.jar with spark-submit doesn't resolve the issue.&lt;/P&gt;</description>
    <pubDate>Sat, 02 Jun 2018 02:21:56 GMT</pubDate>
    <dc:creator>dms1122</dc:creator>
    <dc:date>2018-06-02T02:21:56Z</dc:date>
    <item>
      <title>Error: Exception in thread "main" java.lang.NoSuchMethodError: org.apache.curator.utils.PathUtils.validatePath(Ljava/lang/String;)Ljava/lang/String;</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Error-Exception-in-thread-quot-main-quot-java-lang/m-p/208056#M79076</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;artifact org.apache.curator, version 2.7.1 and higher doesn't work in a spark job.&lt;/P&gt;&lt;P&gt;pom.xml file:&lt;/P&gt;&lt;PRE&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;
&amp;lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&amp;gt;
  &amp;lt;modelVersion&amp;gt;4.0.0&amp;lt;/modelVersion&amp;gt;
  &amp;lt;groupId&amp;gt;com.test&amp;lt;/groupId&amp;gt;
  &amp;lt;artifactId&amp;gt;test&amp;lt;/artifactId&amp;gt;
  &amp;lt;version&amp;gt;0.0.1-SNAPSHOT&amp;lt;/version&amp;gt;
  &amp;lt;packaging&amp;gt;jar&amp;lt;/packaging&amp;gt;
  &amp;lt;name&amp;gt;"test"&amp;lt;/name&amp;gt;
  &amp;lt;build&amp;gt;
    &amp;lt;plugins&amp;gt;
      &amp;lt;plugin&amp;gt;
        &amp;lt;artifactId&amp;gt;maven-assembly-plugin&amp;lt;/artifactId&amp;gt;
        &amp;lt;executions&amp;gt;
          &amp;lt;execution&amp;gt;
            &amp;lt;id&amp;gt;test&amp;lt;/id&amp;gt;
          &amp;lt;/execution&amp;gt;
        &amp;lt;/executions&amp;gt;
      &amp;lt;/plugin&amp;gt;
    &amp;lt;/plugins&amp;gt;
  &amp;lt;/build&amp;gt;
  &amp;lt;dependencies&amp;gt;
    &amp;lt;dependency&amp;gt;
      &amp;lt;groupId&amp;gt;org.apache.curator&amp;lt;/groupId&amp;gt;
      &amp;lt;artifactId&amp;gt;curator-client&amp;lt;/artifactId&amp;gt;
      &amp;lt;version&amp;gt;2.7.1&amp;lt;/version&amp;gt;
    &amp;lt;/dependency&amp;gt;
  &amp;lt;/dependencies&amp;gt;
&amp;lt;/project&amp;gt;
&lt;/PRE&gt;&lt;P&gt;Source code:&lt;/P&gt;&lt;PRE&gt;cat src/main/java/com/test/Test.java &lt;/PRE&gt;
&lt;PRE&gt;package com.test;

import org.apache.curator.utils.PathUtils;

public class Test {
	public static void main(String[] args) throws Exception {
		PathUtils.validatePath("/tmp");
	}
}
&lt;/PRE&gt;&lt;P&gt;The result is&lt;/P&gt;&lt;PRE&gt;spark-submit --class com.test.Test --master local test-0.0.1-SNAPSHOT.jar

Exception in thread "main" java.lang.NoSuchMethodError: org.apache.curator.utils.PathUtils.validatePath(Ljava/lang/String;)Ljava/lang/String;
        at com.test.Test.main(Test.java:7)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.spark.deploy.SparkSubmit$.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:731)
        at org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:181)
        at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:206)
        at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:121)
        at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
&lt;/PRE&gt;&lt;P&gt;The issue is replicated in spark version 1.6.2 and 2.2.0.2.6.4.0-91. Can you please help to resolve this issue?&lt;/P&gt;</description>
      <pubDate>Sat, 02 Jun 2018 00:36:08 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Error-Exception-in-thread-quot-main-quot-java-lang/m-p/208056#M79076</guid>
      <dc:creator>dms1122</dc:creator>
      <dc:date>2018-06-02T00:36:08Z</dc:date>
    </item>
    <item>
      <title>Re: Error: Exception in thread "main" java.lang.NoSuchMethodError: org.apache.curator.utils.PathUtils.validatePath(Ljava/lang/String;)Ljava/lang/String;</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Error-Exception-in-thread-quot-main-quot-java-lang/m-p/208057#M79077</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/18520/dms1122.html" nodeid="18520"&gt;@Maxim Dashenko&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Perhaps when you are packaging your jar file is not adding the curator-client jar correctly to the fat jar. &lt;/P&gt;&lt;P&gt;I tested the following and it works fine:&lt;/P&gt;&lt;P&gt;1. wget &lt;A href="http://central.maven.org/maven2/org/apache/curator/curator-client/2.7.1/curator-client-2.7.1.jar" target="_blank"&gt;http://central.maven.org/maven2/org/apache/curator/curator-client/2.7.1/curator-client-2.7.1.jar&lt;/A&gt;&lt;/P&gt;&lt;P&gt;2. spark-shell --jar curator-client-2.7.1.jar&lt;/P&gt;&lt;P&gt;3. &lt;/P&gt;&lt;PRE&gt;scala&amp;gt; import org.apache.curator.utils.PathUtils;
import org.apache.curator.utils.PathUtils
scala&amp;gt; PathUtils.validatePath("/tmp")
&lt;/PRE&gt;&lt;P&gt;No errors thrown while running the above. You can try adding the --jars and point to the jar file as well and see if that helps. &lt;/P&gt;&lt;PRE&gt;spark-submit --jars curator-client-2.7.1.jar --class com.test.Test --master local test-0.0.1-SNAPSHOT.jar&lt;/PRE&gt;&lt;P&gt;Otherwise I suggest you check your fat/uber jar.&lt;/P&gt;&lt;P&gt;HTH&lt;/P&gt;&lt;P&gt;*** If you found this answer addressed your question, please take a moment to login and click the "accept" link on the answer.&lt;/P&gt;</description>
      <pubDate>Sat, 02 Jun 2018 00:46:21 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Error-Exception-in-thread-quot-main-quot-java-lang/m-p/208057#M79077</guid>
      <dc:creator>falbani</dc:creator>
      <dc:date>2018-06-02T00:46:21Z</dc:date>
    </item>
    <item>
      <title>Re: Error: Exception in thread "main" java.lang.NoSuchMethodError: org.apache.curator.utils.PathUtils.validatePath(Ljava/lang/String;)Ljava/lang/String;</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Error-Exception-in-thread-quot-main-quot-java-lang/m-p/208058#M79078</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/11048/falbani.html" nodeid="11048"&gt;@Felix Albani&lt;/A&gt; thank you for your answer, spark-shell in your sample works because it uses embedded PathUtils artifact:&lt;/P&gt;&lt;PRE&gt;scala&amp;gt; classOf[PathUtils].getProtectionDomain().getCodeSource().getLocation()
res1: java.net.URL = file:/usr/hdp/2.6.4.0-91/spark/lib/spark-assembly-1.6.3.2.6.4.0-91-hadoop2.7.3.2.6.4.0-91.jar&amp;lt;br&amp;gt;&lt;/PRE&gt;&lt;P&gt;In my sample I have only one dependency, so the issue can't be caused by the fat jar.&lt;/P&gt;&lt;P&gt;Using --jars curator-client-2.7.1.jar with spark-submit doesn't resolve the issue.&lt;/P&gt;</description>
      <pubDate>Sat, 02 Jun 2018 02:21:56 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Error-Exception-in-thread-quot-main-quot-java-lang/m-p/208058#M79078</guid>
      <dc:creator>dms1122</dc:creator>
      <dc:date>2018-06-02T02:21:56Z</dc:date>
    </item>
    <item>
      <title>Re: Error: Exception in thread "main" java.lang.NoSuchMethodError: org.apache.curator.utils.PathUtils.validatePath(Ljava/lang/String;)Ljava/lang/String;</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Error-Exception-in-thread-quot-main-quot-java-lang/m-p/208059#M79079</link>
      <description>&lt;P&gt;&lt;A href="https://community.hortonworks.com/users/18520/dms1122.html"&gt;@Maxim Dashenko&lt;/A&gt; sorry about that. The following is working fine:&lt;/P&gt;&lt;PRE&gt;spark-shell --driver-class-path curator-client-2.7.1.jar
scala&amp;gt; import org.apache.curator.utils.PathUtils;
import org.apache.curator.utils.PathUtils
scala&amp;gt; classOf[PathUtils].getProtectionDomain().getCodeSource().getLocation()
res0: java.net.URL = file:/root/curator-client-2.7.1.jar&lt;/PRE&gt;&lt;P&gt;Try adding --driver-class-path curator-client-2.7.1.jar to your spark-submit and let me know if it works fine. Also you may want to try using --conf &lt;STRONG&gt;spark.driver.userClassPathFirst&lt;/STRONG&gt;=true with the jar and see if that helps.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Sat, 02 Jun 2018 03:00:01 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Error-Exception-in-thread-quot-main-quot-java-lang/m-p/208059#M79079</guid>
      <dc:creator>falbani</dc:creator>
      <dc:date>2018-06-02T03:00:01Z</dc:date>
    </item>
    <item>
      <title>Re: Error: Exception in thread "main" java.lang.NoSuchMethodError: org.apache.curator.utils.PathUtils.validatePath(Ljava/lang/String;)Ljava/lang/String;</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Error-Exception-in-thread-quot-main-quot-java-lang/m-p/208060#M79080</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/11048/falbani.html" nodeid="11048"&gt;@Felix Albani&lt;/A&gt; using --driver-class-path curator-client-2.7.1.jar for spark-submit has resolved the issue, thank you very much for your help!&lt;/P&gt;</description>
      <pubDate>Sat, 02 Jun 2018 03:43:01 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Error-Exception-in-thread-quot-main-quot-java-lang/m-p/208060#M79080</guid>
      <dc:creator>dms1122</dc:creator>
      <dc:date>2018-06-02T03:43:01Z</dc:date>
    </item>
    <item>
      <title>Re: Error: Exception in thread "main" java.lang.NoSuchMethodError: org.apache.curator.utils.PathUtils.validatePath(Ljava/lang/String;)Ljava/lang/String;</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Error-Exception-in-thread-quot-main-quot-java-lang/m-p/208061#M79081</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/18520/dms1122.html" nodeid="18520"&gt;@Maxim Dashenko&lt;/A&gt; I'm glad it got resolved. Please take a moment to login and click the "accept" link on the answer!&lt;/P&gt;</description>
      <pubDate>Sat, 02 Jun 2018 03:49:06 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Error-Exception-in-thread-quot-main-quot-java-lang/m-p/208061#M79081</guid>
      <dc:creator>falbani</dc:creator>
      <dc:date>2018-06-02T03:49:06Z</dc:date>
    </item>
  </channel>
</rss>

