flink-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wendong <wendong....@gmail.com>
Subject Flink Kafka runtime error
Date Wed, 15 Jul 2015 18:45:43 GMT
Hello,

I am using Flink 0.9, Scala 2.10.4, Kafka 0.8.2.1 and trying to consume
Kafka messages in Flink. 

Here is the build.sbt:
 
scalaVersion := "2.10.4"

libraryDependencies += "org.apache.flink" % "flink-connector-kafka" %
"0.9.0" exclude("org.apache.kafka", "kafka_${scala.binary.version}")
libraryDependencies += "org.apache.kafka" %% "kafka" % "0.8.2.1"

My program TestKafka.scala is simple:

import org.apache.flink.streaming.api.environment._
import org.apache.flink.streaming.connectors.kafka
import org.apache.flink.streaming.connectors.kafka.api._
import org.apache.flink.streaming.util.serialization._

object TestKafka {
  def main(args: Array[String]) {
    val env = StreamExecutionEnvironment.getExecutionEnvironment
    val stream = env
     .addSource(new KafkaSource[String]("localhost:2181", "test", new
SimpleStringSchema))
     .print
  }
}

Compilation is fine. However, when I run the jar file using:
./bin/flink run /path/to/project/target/scala-2.10/TestKafka_2.10-1.0.jar, I
got runtime errors:

java.lang.NoClassDefFoundError:
org/apache/flink/streaming/connectors/kafka/api/KafkaSource
        at TestKafka$.main(TestKafka.scala:10)
        at TestKafka.main(TestKafka.scala)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
.................
Caused by: java.lang.ClassNotFoundException:
org.apache.flink.streaming.connectors.kafka.api.KafkaSource
        at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
.........

Any additional setting is missing? 

Thanks for help!

Wendong




--
View this message in context: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/Flink-Kafka-runtime-error-tp2063.html
Sent from the Apache Flink User Mailing List archive. mailing list archive at Nabble.com.

Mime
View raw message