When running unit tests that create a spark context I get an java.lang.SecurityException
. I understand what the cause is but not sure how to track down how to solve it. This being that multiple dependencies sharing the same package javax.servlet
having different signer information.
// Dependencies
libraryDependencies ++= Seq(
"org.apache.spark" % "spark-hive_2.10" % "1.6.2" % Provided
)
// Test dependencies
libraryDependencies ++= Seq(
"junit" % "junit" % "4.10" % Test,
"org.scalatest" %% "scalatest" % "3.0.4" % Test,
"org.apache.hadoop" % "hadoop-minicluster" % "2.5.0" % Test
)
I've created a sample project to demonstrate this.
There are many examples of this same problem which suggest exclusion rules for org.mortonbay.jetty
and javax.servlet
, though none seem to work for me.
when I use spark-submit
on the built sbt assembly
jar it works file, I just can't write tests for it.