title: Resolving "Kryo serialization failed: Buffer overflow" Spark exception
body: <p>I am trying to run Spark (Java) code and getting the error</p>
  
  <pre><code>org.apache.spark.SparkException: Kryo serialization failed: Buffer overflow. Available: 0, required: 27".
  </code></pre>
  
  <p>Other posts have suggested setting the buffer to its max value. When I tried this with max buffer value of 512MB I got the error</p>
  
  <pre><code>java.lang.ClassNotFoundException: org.apache.spark.serializer.KryoSerializer.buffer.max', '512'
  </code></pre>
  
  <p>How can I solve this problem?</p>