gpt4 book ai didi

scala - Spark 应用程序抛出 javax.servlet.FilterRegistration

转载 作者:行者123 更新时间:2023-12-03 07:26:29 25 4
gpt4 key购买 nike

我正在使用 Scala 在本地创建并运行 Spark 应用程序。

我的build.sbt:

name : "SparkDemo"
version : "1.0"
scalaVersion : "2.10.4"
libraryDependencies += "org.apache.spark" %% "spark-core" % "1.2.0" exclude("org.apache.hadoop", "hadoop-client")
libraryDependencies += "org.apache.spark" % "spark-sql_2.10" % "1.2.0"
libraryDependencies += "org.apache.hadoop" % "hadoop-common" % "2.6.0" excludeAll(
ExclusionRule(organization = "org.eclipse.jetty"))
libraryDependencies += "org.apache.hadoop" % "hadoop-mapreduce-client-core" % "2.6.0"
libraryDependencies += "org.apache.hbase" % "hbase-client" % "0.98.4-hadoop2"
libraryDependencies += "org.apache.hbase" % "hbase-server" % "0.98.4-hadoop2"
libraryDependencies += "org.apache.hbase" % "hbase-common" % "0.98.4-hadoop2"
mainClass in Compile := Some("demo.TruckEvents")

在运行时我遇到异常:

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

此处触发异常:

val sc = new SparkContext("local", "HBaseTest")

我正在使用 IntelliJ Scala/SBT 插件。

我看到其他人也有这个问题suggestion solution 。但这是一个 Maven 构建...我的 sbt 错了吗?或者有其他建议如何解决这个问题?

最佳答案

查看我对类似问题的回答 here 。类冲突的产生是因为HBase依赖于org.mortbay.jetty,而Spark依赖于org.eclipse.jetty。我能够通过从 HBase 中排除 org.mortbay.jetty 依赖项来解决该问题。

如果您要引入 hadoop-common,那么您可能还需要从 hadoop-common 中排除 javax.servlet。我有一个有效的 HBase/Spark 设置,其 sbt 依赖项设置如下:

val clouderaVersion = "cdh5.2.0"
val hadoopVersion = s"2.5.0-$clouderaVersion"
val hbaseVersion = s"0.98.6-$clouderaVersion"
val sparkVersion = s"1.1.0-$clouderaVersion"

val hadoopCommon = "org.apache.hadoop" % "hadoop-common" % hadoopVersion % "provided" excludeAll ExclusionRule(organization = "javax.servlet")
val hbaseCommon = "org.apache.hbase" % "hbase-common" % hbaseVersion % "provided"
val hbaseClient = "org.apache.hbase" % "hbase-client" % hbaseVersion % "provided"
val hbaseProtocol = "org.apache.hbase" % "hbase-protocol" % hbaseVersion % "provided"
val hbaseHadoop2Compat = "org.apache.hbase" % "hbase-hadoop2-compat" % hbaseVersion % "provided"
val hbaseServer = "org.apache.hbase" % "hbase-server" % hbaseVersion % "provided" excludeAll ExclusionRule(organization = "org.mortbay.jetty")
val sparkCore = "org.apache.spark" %% "spark-core" % sparkVersion % "provided"
val sparkStreaming = "org.apache.spark" %% "spark-streaming" % sparkVersion % "provided"
val sparkStreamingKafka = "org.apache.spark" %% "spark-streaming-kafka" % sparkVersion exclude("org.apache.spark", "spark-streaming_2.10")

关于scala - Spark 应用程序抛出 javax.servlet.FilterRegistration,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28086520/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com