title: JSON4s can't find constructor w/spark
body: <p>I've run into an issue with attempting to parse json in my spark job. I'm using spark 1.1.0, json4s, and the Cassandra Spark Connector, with DSE 4.6. The exception thrown is:</p>
  
  <pre><code>org.json4s.package$MappingException: Can't find constructor for BrowserData      org.json4s.reflect.ScalaSigReader$.readConstructor(ScalaSigReader.scala:27)
     org.json4s.reflect.Reflector$ClassDescriptorBuilder.ctorParamType(Reflector.scala:108)
          org.json4s.reflect.Reflector$ClassDescriptorBuilder$$anonfun$6.apply(Reflector.scala:98)
          org.json4s.reflect.Reflector$ClassDescriptorBuilder$$anonfun$6.apply(Reflector.scala:95)
          scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
  </code></pre>
  
  <p>My code looks like this: </p>
  
  <pre><code>case class BrowserData(navigatorObjectData: Option[NavigatorObjectData],
                         flash_version: Option[FlashVersion],
                         viewport: Option[Viewport],
                         performanceData: Option[PerformanceData])
  
  .... other case classes
  
  def parseJson(b: Option[String]): Option[String] = {
      implicit val formats = DefaultFormats
        for {
          browserDataStr &lt;- b
          browserData = parse(browserDataStr).extract[BrowserData]
          navObject &lt;- browserData.navigatorObjectData
          userAgent &lt;- navObject.userAgent
        } yield (userAgent)
    }
  
  def getJavascriptUa(rows: Iterable[com.datastax.spark.connector.CassandraRow]): Option[String] = {
    implicit val formats = DefaultFormats
    rows.collectFirst { case r if r.getStringOption("browser_data").isDefined  =&gt;
      parseJson(r.getStringOption("browser_data"))
    }.flatten
  }
  
  def getRequestUa(rows: Iterable[com.datastax.spark.connector.CassandraRow]): Option[String] = {
    rows.collectFirst { case r if r.getStringOption("ua").isDefined  =&gt;
      r.getStringOption("ua")
    }.flatten
  }
  
  def checkUa(rows: Iterable[com.datastax.spark.connector.CassandraRow], sessionId: String): Option[Boolean] = {
    for {
      jsUa &lt;- getJavascriptUa(rows)
      reqUa &lt;- getRequestUa(rows)
    } yield (jsUa == reqUa)
  }
  
  def run(name: String) = {
    val rdd = sc.cassandraTable("beehive", name).groupBy(r =&gt; r.getString("session_id"))
    val counts = rdd.map(r =&gt; (checkUa(r._2, r._1)))
    counts
  }
  </code></pre>
  
  <p>I use <code>:load</code> to load the file into the REPL, and then call the <code>run</code> function. The failure is happening in the <code>parseJson</code> function, as far as I can tell. I've tried a variety of things to try to get this to work. From similar <a href="https://github.com/json4s/json4s/issues/143" rel="nofollow">posts</a>, I've made sure my case classes are in the top level in the file. I've tried compiling just the case class definitions into a jar, and including the jar in like this: <code>/usr/bin/dse spark --jars case_classes.jar</code></p>
  
  <p>I've tried adding them to the conf like this: <code>sc.getConf.setJars(Seq("/home/ubuntu/case_classes.jar"))</code></p>
  
  <p>And still the same error. Should I compile all of my code into a jar? Is this a spark issue or a JSON4s issue? Any help at all appreciated. </p>