title: How to use 3rd party libraries which are not Serializable with Spark
body: <p>I want to use a 3rd party library(Wiremock) with Spark. However, I get the following exception:</p>
  
  <pre><code>Caused by: java.io.NotSerializableException:com.github.tomakehurst.wiremock.WireMockServer
  Serialization stack:
      - object not serializable(class:com.github.tomakehurst.wiremock.WireMockServer, value: com.github.tomakehurst.wiremock.WireMockServer@51813065)
  </code></pre>
  
  <p>Is there a general way to deal with this?</p>