Scala / sbt java.lang.ClassNotFoundException: com.ullink.slack.simpleslackapi.listeners.SlackMessagePostedListener
Я хочу включить Slack Api в проект Stream Streaming в Scala / SBT. Когда я запускаю программу, я получаю исключение класса не найден - я думаю, что есть проблемы с зависимостями?
ошибка:
Exception in thread "main" java.lang.NoClassDefFoundError: com/ullink/slack/simpleslackapi/listeners/SlackMessagePostedListener at org.apache.spark.sql.streaming.DataStreamReader.load(DataStreamReader.scala:175) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.spark.deploy.JavaMainApplication.start(SparkApplication.scala:52) at org.apache.spark.deploy.SparkSubmit$.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:894) at org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:198) at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:228) at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:137) at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala) Caused by: java.lang.ClassNotFoundException: com.ullink.slack.simpleslackapi.listeners.SlackMessagePostedListener at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 17 more
build.sbt выглядит так:
name := "slackKnowledgeCollector"
version := "0.1"
scalaVersion := "2.11.8"
val sparkVersion = "2.3.1"
resolvers ++= Seq(
"Hortonworks" at "http://repo.hortonworks.com/content/repositories/releases/",
"Hortonworks Groups" at "http://repo.hortonworks.com/content/groups/public/",
"Apache Snapshots" at "https://repository.apache.org/content/repositories/releases/",
"Maven Central" at "http://central.maven.org/maven2/"
Resolver.mavenLocal
)
libraryDependencies ++= Seq(
"org.apache.spark" %% "spark-core" % sparkVersion % Provided,
"org.apache.spark" %% "spark-sql" % sparkVersion % Provided,
"org.apache.spark" %% "spark-sql-kafka-0-10" % sparkVersion,
//"org.apache.spark" %% "spark-streaming" % sparkVersion % Provided,
//"org.apache.spark" %% "spark-streaming-kafka-0-10" % sparkVersion % Provided,
"org.apache.kafka" %% "kafka" % "0.10.0.2.5.3.0-37",
"com.ullink.slack" % "simpleslackapi" % "1.2.0" excludeAll(
ExclusionRule(organization = "org.apache.httpcomponents"),
ExclusionRule(organization = "com.google.guava"),
ExclusionRule(organization = "ch.qos.logback"),
ExclusionRule(organization = "org.slf4j")
)
)
assemblyOption in assembly := (assemblyOption in assembly).value.copy(includeScala = false, cacheOutput = false)
test in assembly := {}
assemblyMergeStrategy in assembly := {
case PathList("org", "apache", "spark", "unused", "UnusedStubClass.class") => MergeStrategy.discard
case x =>
val oldStrategy = (assemblyMergeStrategy in assembly).value
oldStrategy(x)
}
scalacOptions += "-target:jvm-1.8"
У кого-нибудь есть идеи, как это решить?
1 ответ
Решение
Проблема решена... Раньше я звонил в обычную банку, а не в супер-банку. Тема может быть закрыта