flink 任务启动失败:Caused by: java.lang.ClassCastException: io.netty.channel.epoll.EpollEventLoopGroup can

场景:使用flink 连接Cassandra报错:

Caused by: java.lang.ClassCastException: io.netty.channel.epoll.EpollEventLoopGroup cannot be cast to io.netty.channel.EventLoopGroup
    at com.datastax.driver.core.NettyUtil.newEventLoopGroupInstance(NettyUtil.java:134)
    at com.datastax.driver.core.NettyOptions.eventLoopGroup(NettyOptions.java:95)
    at com.datastax.driver.core.Connection$Factory.(Connection.java:926)
    at com.datastax.driver.core.Cluster$Manager.init(Cluster.java:1499)
    at com.datastax.driver.core.Cluster.init(Cluster.java:208)
    at com.datastax.driver.core.Cluster.connectAsync(Cluster.java:376)

解决方法:    
https://stackoverflow.com/questions/48762857/java-lang-classcastexception-netty-fail-on-jar-execution-on-flink

 

You can disable the Netty’s native epoll transport and force the default NIO-based transport by adding the JVM argument -Dcom.datastax.driver.FORCE_NIO=true.
(https://docs.datastax.com/en/developer/java-driver-dse/1.4/faq/#what-is-netty-s-native-epoll-transport-and-how-do-i-enable-or-disable-it)

In Flink you have to set env.java.opts into the conf/flink-conf.yaml with that argument.
(https://ci.apache.org/projects/flink/flink-docs-release-1.4/ops/config.html#common-options)

 

解决方法:

flink-conf.yaml中增加

env.java.opts: -Dcom.datastax.driver.FORCE_NIO=true 参数。

原因看第一篇文档

 

 

 

 

你可能感兴趣的:(flink)