spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kah-Chan Low <kahchan...@yahoo.com.INVALID>
Subject Eclipse flags error on KafkaUtils.createStream()
Date Thu, 08 Jan 2015 03:25:33 GMT
Hi,I am using Eclipse writing Java code.
I am trying to create a Kafka receiver by:
JavaPairReceiverInputDStream<String, kafka.message.Message> a  = KafkaUtils.createStream(jssc,
String.class, Message.class,
                        StringDecoder.class, DefaultDecoder.class,
kafkaParams,
                        topics, StorageLevel.MEMORY_AND_DISK());
where jssc, kafkaParams, and topics are all properly defined.
I am getting flagged by Eclipse with the following messages:"The type scala.reflect.ClassTag
cannot be resolved. It is indirectly referenced from required .class files"

I don't know Scala and it seems that scala.reflect.ClassTag is an unusual class which can
not be imported simply by using an "import" statement.
I haveimport scala.reflect.*;but it doesn't help.
In my pom.xml I have:    
<dependency>
      <groupId>org.scala-lang</groupId>
      <artifactId>scala-reflect</artifactId>
      <version>2.11.4</version></dependency>
That doesn't help either.
Is Eclipse flagging a real problem?
A solution suggested by Eclipse is to edit the Java Build Path using the UI below. However,
I have no idea what to do.

 
 
I would rather use the API below that doesn't require passing in of StringDecoder and DefaultDecoder
below. However, the contents of my Kafka messages are not Strings. Is there any way to use
this APIwith non-String Kafka messages?
public static JavaPairReceiverInputDStream<String,String> createStream(JavaStreamingContext jssc,
                                                       String zkQuorum,
                                                       String groupId,
                                                       java.util.Map<String,Integer> topics,
                                                       StorageLevel storageLevel)
Thanks!!KC

Mime
View raw message