Spark java.lang.SecurityException:class" javax.servlet.FilterRegistration"'与sbt

时间:2015-11-18 15:27:47

标签: exception servlets apache-spark

这让我感到疯狂,我已经尝试过解决方案,但无法让它发挥作用。所以我有一个使用Spark的项目,由sbt管理。 我得知所有错误:

Exception in thread "main" java.lang.SecurityException: class "javax.servlet.FilterRegistration"'s signer information does not match signer information of other classes in the same package

(部分)build.sbt是:

scalaVersion := "2.11.7"

//Library repositories
resolvers ++= Seq(
  Resolver.mavenLocal,
  "Scala-Tools Maven2 Repository" at "http://scala-tools.org/repo-releases",
  "Java.net repository" at "http://download.java.net/maven/2",
  "GeoTools" at "http://download.osgeo.org/webdav/geotools",
  "Apache" at "https://repository.apache.org/service/local/repositories/releases/content",
  "Cloudera" at "https://repository.cloudera.com/artifactory/cloudera-repos/",
  "OpenGeo Maven Repository" at "http://repo.opengeo.org",
  "Typesafe" at "https://repo.typesafe.com/typesafe/releases/",
  "Spray Repository" at "http://repo.spray.io"
)

//Library versions
val geotools_version = "13.2"
val accumulo_version = "1.6.0-cdh5.1.4"
val hadoop_version = "2.6.0-cdh5.4.5"
val hadoop_client_version = "2.6.0-mr1-cdh5.4.5"
val geowave_version = "0.9.0-SNAPSHOT"
val akka_version = "2.4.0"
val spray_version = "1.3.3"
val spark_version = "1.5.0"

//Library Dependencies
libraryDependencies ++= Seq(
  "org.scala-lang" % "scala-library" % scalaVersion.value,
  "org.scala-lang" % "scala-reflect" % scalaVersion.value,
  "org.geotools" % "gt-data" % geotools_version,
  "org.geotools" % "gt-geojson" % geotools_version,
  "org.apache.accumulo" % "accumulo-core" % accumulo_version
    exclude(org = "javax.servlet", name = "servlet-api")
    exclude(org = "javax.servlet", name = "jsp-api"),
  "org.apache.hadoop" % "hadoop-common" % hadoop_version
    exclude(org = "javax.servlet", name = "servlet-api")
    exclude(org = "javax.servlet", name = "jsp-api"),
  "org.apache.hadoop" % "hadoop-client" % hadoop_client_version
    exclude(org = "javax.servlet", name = "servlet-api")
    exclude(org = "javax.servlet", name = "jsp-api"),
  "mil.nga.giat" % "geowave-core-store" % geowave_version,
  "mil.nga.giat" % "geowave-datastore-accumulo" % geowave_version,
  "mil.nga.giat" % "geowave-adapter-vector" % geowave_version,
  "com.typesafe" % "config" % "1.3.0",
  "com.typesafe.akka" %% "akka-actor" % akka_version,
  "io.spray" %% "spray-can" % spray_version,
  "io.spray" %% "spray-routing" % spray_version,
  "io.spray" %% "spray-testkit" % spray_version % "test",
  "org.apache.spark" %% "spark-core" % spark_version,
  "org.scalatest" % "scalatest_2.11" % "2.2.4" % "test"
)

test in assembly := {}

我试图排除任何名称为javax.servlet的内容,但必须做错事,因为它不起作用。

感谢您的时间

1 个答案:

答案 0 :(得分:4)

org.mortbay.jetty上添加排除规则。如:

libraryDependencies ++= Seq(...).map(
  _.excludeAll(ExclusionRule(organization = "org.mortbay.jetty"))
)