Error while cloning an object inside a map function on a RDD
<p>I am trying to develop some exotic transformation on a Spark <code>RDD</code>. In detail, inside a <code>map</code>, I am using <code>org.apache.commons.lang.SerializationUtils</code> to clone a complex object.</p>

<p>Here is the code:</p>

<pre><code>val rdd: RDD[A] = // Getting the rdd...
rdd.map(SerializationUtils.clone(_));
</code></pre>

<p>The class <code>A</code> is a Java class that obviously implements <code>Serializable</code>.</p>

<pre><code>public class A implements Serializable {
    // Some cool stuff
}
</code></pre>

<p>When the above transformation is executed by Spark we obtain the error <code>org.apache.commons.lang.SerializationException: java.lang.ClassNotFoundException: A</code>. Moreover, the error is encountered only when the code is executed on a cluster.</p>

<p>What the hell is going on?!</p>

<p><strong>EDIT</strong>: it <em>works</em> using another tecnique to clone the objects. Then, It has to be some problem related to integration between Spark and the apache-common lib.</p>