<p>Apache Spark: 3.0.0
Protobuf: 3.5.1</p>
<p>Exception:
<code>&quot;main&quot; java.lang.NoSuchMethodError: com.google.protobuf.Descriptors$Descriptor.getOneofs()Ljava/util/List;</code></p>
<p>Issue: When submitting my spake scala application on my local kubernetes, I am getting:
<code>&quot;java.lang.NoSuchMethodError: com.google.protobuf.Descriptors$Descriptor.getOneofs()Ljava/util/List;&quot;</code></p>
<p>Seems there is a conflict in dependency for Protobuff.</p>
<p>Have tried a few things like <a href="https://github.com/nats-io/stan.java/issues/20" rel="nofollow noreferrer">https://github.com/nats-io/stan.java/issues/20</a> but nothing is working.</p>
<p>my build.sbt:</p>
<pre><code>name := &quot;test&quot;

version := &quot;0.1&quot;
scalaVersion := &quot;2.12.8&quot;

val sparkVersion = &quot;3.0.0&quot;
val protobufVersion = &quot;3.5.1&quot;

resolvers += &quot;confluent&quot; at &quot;http://packages.confluent.io/maven/&quot;
resolvers += Resolver.jcenterRepo
resolvers += &quot;Spark Packages Repo&quot; at &quot;http://dl.bintray.com/spark-packages/maven&quot;

assemblyMergeStrategy in assembly := {
  case &quot;META-INF/services/org.apache.spark.sql.sources.DataSourceRegister&quot; =&gt; MergeStrategy.concat
  case PathList(&quot;META-INF&quot;, xs@_*) =&gt; MergeStrategy.discard
  case &quot;application.conf&quot; =&gt; MergeStrategy.concat
  case x =&gt; MergeStrategy.first
}

assemblyShadeRules in assembly := Seq(
  ShadeRule.rename(&quot;com.google.protobuf.*&quot; -&gt; &quot;shadedproto.@1&quot;).inProject
    .inLibrary(&quot;com.google.protobuf&quot; % &quot;protobuf-java&quot; % protobufVersion)
)

coverageEnabled.in(ThisBuild, IntegrationTest, test) := true

//skipping test cases during package
test in assembly := {}

lazy val server = (project in file(&quot;.&quot;))
  .configs(IntegrationTest)
  .settings(Defaults.itSettings)

libraryDependencies ++= Seq(
  &quot;org.apache.spark&quot; %% &quot;spark-sql&quot; % sparkVersion % Provided,
  &quot;org.apache.spark&quot; %% &quot;spark-sql-kafka-0-10&quot; % sparkVersion,
  &quot;org.apache.kafka&quot; % &quot;kafka-clients&quot; % &quot;2.2.1&quot;,
  &quot;org.postgresql&quot; % &quot;postgresql&quot; % postgreSqlVersion,
  &quot;com.google.protobuf&quot; % &quot;protobuf-java&quot; % protobufVersion,
  &quot;com.typesafe&quot; % &quot;config&quot; % &quot;1.4.0&quot;
)



</code></pre>

JDev
<p>To resolve this you need todo two things.  1) remove the duplicated protobuf library so that there is only one version of it avaible.  2) fix any code that did not use the version of protobuff that spark uses.</p>
<p>One of my favorite quick and dirty tricks to resolve this is to do class search in Intellij of the conflicting class,  in this case &quot;Descriptors&quot;.  This will show all jars that contain the class.  Once you've figured out which jars are bringing in the conflicting class, you can remove one of them.  Chances are its going to be easiest to just match spark's version of protobuf.</p>
<p><a href="https://i.stack.imgur.com/GG2sI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GG2sI.png" alt="enter image description here" /></a></p>
<p>If you sift through the dependencies in maven it seems like it should be using v2.5.0 so some other dependency may be bringing it in.</p>
<p>You may need to check your code to match this version.  Whats the full stack trace of your error?  Is it your code calling the protobuf function or is it another library?  If its another library you may need to fork the library to make it compatible with sparks dependencies.</p>
