title: java.lang.NoSuchMethodError: org.apache.spark.internal.Logging.$init$
body: <p>I am new to Spark and i want to create a structured streaming for Spark to read and display the messages of Kafka topic. I am writing the following in sample.py file:</p>
  
  <pre><code>from pyspark.sql import SparkSession
  from pyspark.sql.functions import explode
  from pyspark.sql.functions import split
  import os
  
  os.environ['PYSPARK_SUBMIT_ARGS'] = '--packages org.apache.spark:spark-sql-kafka-0-10_2.12:2.4.4 pyspark-shell'
  spark = SparkSession.builder.appName("StructuredNetworkWordCount").getOrCreate()
  
  
  df = spark.readStream.format("kafka").option("kafka.bootstrap.servers","localhost:9092").option("subscribe", "testKafka").option("startingOffsets", "earliest").load()
  df.printSchema()
  df.selectExpr("CAST(key AS STRING)", "CAST(value AS STRING)")
  </code></pre>
  
  <p>and I have put the spark-sql-kafka file in the jars folder inside /usr/local/spark. I am running this by writing:
  spark-submit --packages org.apache.spark:spark-sql-kafka-0-10_2.12:2.4.4 sample.py but it is giving me error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "/home/hadoop/structstream.py", line 10, in &lt;module&gt;
      df = spark.readStream.format("kafka").option("kafka.bootstrap.servers","localhost:9092").option("subscribe", "testKafka").option("startingOffsets", "earliest").load()
    File "/usr/local/spark2.4.5/python/lib/pyspark.zip/pyspark/sql/streaming.py", line 400, in load
    File "/usr/local/spark2.4.5/python/lib/py4j-0.10.7-src.zip/py4j/java_gateway.py", line 1257, in __call__
    File "/usr/local/spark2.4.5/python/lib/pyspark.zip/pyspark/sql/utils.py", line 63, in deco
    File "/usr/local/spark2.4.5/python/lib/py4j-0.10.7-src.zip/py4j/protocol.py", line 328, in get_return_value
  py4j.protocol.Py4JJavaError: An error occurred while calling o34.load.
  : java.util.ServiceConfigurationError: org.apache.spark.sql.sources.DataSourceRegister: Provider org.apache.spark.sql.kafka010.KafkaSourceProvider could not be instantiated
      at java.util.ServiceLoader.fail(ServiceLoader.java:232)
      at java.util.ServiceLoader.access$100(ServiceLoader.java:185)
      at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:384)
      at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
      at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
      at scala.collection.convert.Wrappers$JIteratorWrapper.next(Wrappers.scala:43)
      at scala.collection.Iterator$class.foreach(Iterator.scala:891)
      at scala.collection.AbstractIterator.foreach(Iterator.scala:1334)
      at scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
      at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
      at scala.collection.TraversableLike$class.filterImpl(TraversableLike.scala:247)
      at scala.collection.TraversableLike$class.filter(TraversableLike.scala:259)
      at scala.collection.AbstractTraversable.filter(Traversable.scala:104)
      at org.apache.spark.sql.execution.datasources.DataSource$.lookupDataSource(DataSource.scala:630)
      at org.apache.spark.sql.streaming.DataStreamReader.load(DataStreamReader.scala:161)
      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 py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:244)
      at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:357)
      at py4j.Gateway.invoke(Gateway.java:282)
      at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132)
      at py4j.commands.CallCommand.execute(CallCommand.java:79)
      at py4j.GatewayConnection.run(GatewayConnection.java:238)
      at java.lang.Thread.run(Thread.java:748)
  Caused by: java.lang.NoSuchMethodError: org.apache.spark.internal.Logging.$init$(Lorg/apache/spark/internal/Logging;)V
      at org.apache.spark.sql.kafka010.KafkaSourceProvider.&lt;init&gt;(KafkaSourceProvider.scala:44)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
      at java.lang.Class.newInstance(Class.java:442)
      at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:380)
      ... 23 more
  </code></pre>
  
  <p>Why is this happening?</p>