类转换异常
cannot be cast to com.google.protobuf.Message
代码语言:javascript复制
Caused by: java.lang.ClassCastException: org.apache.hadoop.yarn.proto.YarnServiceProtos$RegisterApplicationMasterRequestProto cannot be cast to com.google.protobuf.Message
at org.apache.hadoop.ipc.ProtobufRpcEngine$Invoker.invoke(ProtobufRpcEngine.java:227)
at com.sun.proxy.$Proxy14.registerApplicationMaster(Unknown Source)
at org.apache.hadoop.yarn.api.impl.pb.client.ApplicationMasterProtocolPBClientImpl.registerApplicationMaster(ApplicationMasterProtocolPBClientImpl.java:106)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.hadoop.io.retry.RetryInvocationHandler.invokeMethod(RetryInvocationHandler.java:256)
at org.apache.hadoop.io.retry.RetryInvocationHandler.invoke(RetryInvocationHandler.java:104)
at com.sun.proxy.$Proxy15.registerApplicationMaster(Unknown Source)
at org.apache.hadoop.yarn.client.api.impl.AMRMClientImpl.registerApplicationMaster(AMRMClientImpl.java:222)
at org.apache.hadoop.yarn.client.api.impl.AMRMClientImpl.registerApplicationMaster(AMRMClientImpl.java:214)
at org.apache.hadoop.yarn.client.api.async.impl.AMRMClientAsyncImpl.registerApplicationMaster(AMRMClientAsyncImpl.java:138)
at org.apache.flink.yarn.YarnResourceManager.createAndStartResourceManagerClient(YarnResourceManager.java:205)
at org.apache.flink.yarn.YarnResourceManager.initialize(YarnResourceManager.java:234)
... 11 common frames omitted
这种问题一般发生在将flink程序部署到yarn集群的时候,由于flink启动的时候会加载hadoop下面的jar包,加到自己的classpath里,如果hadoop的jar包和自己flink工程的jar包版本不一致就会导致这个问题,解决办法:排除自己工程中的hadoop相关的jar,打包的时候不要打进来.
代码语言:javascript复制
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-common</artifactId>
<version>${hadoop.version}</version>
<scope>provided</scope>
</dependency>
提示,有可能你没有显式的引入hadoop-common、hadoop-hdfs这样的jar包,但是你引入了hbase的jar包,因为hbase会引入hdfs相关的jar包,也会导致类似的错误。
local class incompatible
代码语言:javascript复制org.apache.flink.table.api.StreamQueryConfig; local class incompatible: stream classdesc serialVersionUID = XXX, local class serialVersionUID = -XXX
在提交flink程序的时候如果出现这种情况一般是由于jar包冲突导致的,可能是某一个jar的冲突、也可能是scala的版本不一致导致的,比如你的flink集群的scala是2.11,你的程序的scala版本是2.12。