我试图建立一个测试scala作业,以使用flink流连接器从kafka流数据中读取数据,但收到以下错误
java.lang.ClassNotFoundException:scala.Serializable
import java.util.Properties
import org.apache.flink.api.common.typeinfo.TypeInformation
import org.apache.flink.streaming.api.scala.StreamExecutionEnvironment
import org.apache.flink.streaming.connectors.kafka.FlinkKafkaConsumer
import org.apache.flink.api.common.serialization.SimpleStringSchema
object kafka_int_s3 {
def main(args: Array[String]): Unit = {
implicit val typeInfo = TypeInformation.of(classOf[(String)])
val env: StreamExecutionEnvironment =
StreamExecutionEnvironment.getExecutionEnvironment
val properties = new Properties()
properties.setProperty("bootstrap.servers", "localhost:9092")
properties.setProperty("zookeeper.connect", "localhost:2181")
properties.setProperty("group.id", "test")
properties.setProperty("auto.offset.reset", "earliest")
val kkConsumer = new FlinkKafkaConsumer[String](
"testtopic",
new SimpleStringSchema(),
properties)
val stream = env
.addSource(kkConsumer)
.print()
}
}