分享

【求助】object serializer is not a member of package

唐运 发表于 2015-3-18 19:09:27 [显示全部楼层] 回帖奖励 阅读模式 关闭右栏 2 47993
测试Spark Streaming的DirectStream时需要设置泛型,import  kafka.serializer.StringDecoder导入后报错,哪位碰到过类似的问题?
object serializer is not a member of package org.apache.spark.streaming.kafka

val lines =KafkaUtils.createDirectStream[String, String, StringDecoder, StringDecoder](ssc, kafkaParams, topicsSet).map(_._2)

已有(2)人评论

跳转到指定楼层
nextuser 发表于 2015-3-18 19:47:55
serializer 对象不属于这个包 org.apache.spark.streaming.kafka

首先找到包org.apache.spark.streaming.kafka
然后确认是否存在serializer对象

第二步,看下 serializer是否有多个包都包含这个对象的情况
回复

使用道具 举报

langke93 发表于 2015-3-18 22:46:34
其实应该是包的问题,下面例子,希望对楼主有所启发
例子1:

参考:http://stackoverflow.com/questio ... er-of-package-scala

Scala-XML has been factored out into a separate library as of Scala 2.11, so it is not included in Scala projects by default. To include it in your project via sbt add this dependency:

  1. libraryDependencies += "org.scala-lang.modules" %% "scala-xml" % "1.0.2"
复制代码



例子2:

执行这条命令报错
  1. java -cp D:\tools\apache-ant-1.7.0\lib\ant.jar;D:\tools\scala-2.9.1.final\lib\scala-compiler.jar;D:\tools\scala-2.9.1.final\lib\scala-library.jar -Dscala.usejavacp=true scala.tools.nsc.MainGenericRunner D:\test\scala\ant.scala
复制代码
这条命令则可以
java -Dscala.usejavacp=true -cp d:\Dev\scala-2.9.1.final\lib\scala-compiler.jar;d:\Dev\scala-2.9.1.final\lib\scala-library.jar scala.tools.nsc.MainGenericRunner -cp d:\Dev\apache-ant-1.8.2\lib\ant.jar D:\test\scala\ant.scala










回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

推荐上一条 /2 下一条