I am new to Flink and I was following the SocketWindowWordCount example.
I am using Scala 2.11.8 and Flink 1.3.2 and try to run it on EMR, when I run the following code, it threw errors:
Caused by: java.lang.ClassNotFoundException: org.apache.flink.api.common.typeinfo.TypeInformation
The main class looks like this:
import org.apache.flink.streaming.api.scala._
import org.apache.flink.streaming.api.windowing.time.Time
object FlinkStreamingPOC {
def main(args: Array[String]) : Unit = {
val env = StreamExecutionEnvironment.getExecutionEnvironment
val stream = env.readTextFile("s3a://somebucket/prefix")
val counts = stream.flatMap{ _.split("\\W+") }
.map { (_, 1) }
.keyBy(0)
.timeWindow(Time.seconds(10))
.sum(1)
counts.print
env.execute("Window Stream WordCount")
}
}
build.sbt looks like this:
scalaVersion := "2.11.8"
val flinkVersion = "1.3.2"
libraryDependencies ++= Seq(
"org.apache.flink" %% "flink-scala" % flinkVersion,
"org.apache.flink" %% "flink-streaming-scala" % flinkVersion
)
I tried to import org.apache.flink.api.scala._
and org.apache.flink.streaming.api.scala._
but still got the same error message. Please suggest, thanks!
If you use IDEA, you can include dependencies with "Provided" scope.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With