[英]Flink Job : Getting InvalidClassException: com.fasterxml.jackson.databind.ObjectMapper
Our flink job is running perfectly fine in local but while trying to deploy it in yarn cluster it is throwing below error . 我们的flink作业在本地运行得很好,但是在尝试将其部署到纱线簇中时却抛出了错误。
Flink version : 1.5.0 Jackson 2.6.7 Flink版本:1.5.0 Jackson 2.6.7
Caused by: java.io.InvalidClassException: com.fasterxml.jackson.databind.ObjectMapper; local class incompatible: stream classdesc serialVersionUID = 2, local class serialVersionUID = 1
I have tried with different flink versions and the issue is coming with all the versions. 我尝试使用不同的flink版本,所有版本都出现了问题。
DataStream stream = DataStreamManager
.getStatusUpdateStream(kafkaConsumerConfig, env)
.filter(new CheckStatusUpdate())
.keyBy(new OrderUpdateKeySelector());
stream.process(new ProcessBookingUpdatesEvents(config)).setParallelism(processBookingUpdatesEventsParallelism)
.process(new ExecuteOrderStatusUpdateNotifierFilter(config)).setParallelism(filterParallelism)
.process(new ProcessOrderPostFiltering(config,communicationConfig)).setParallelism(processOrderPostFilteringParallelism);
Command to submit flink job: 提交flink作业的命令:
export HADOOP_CLASSPATH=`hadoop classpath`;HADOOP_CONF_DIR=/etc/hadoop/conf flink-1.5.0/bin/flink run -m yarn-cluster -yn 2 -ys 1 -yjm 2048 -ytm 4096 -yst -ynm order_updates -yqu default -p 1 -c com.order.workflow.consumer.flink.OrderStatusUpdateJob orchestrator-build-1.0.21-staging.jar config.yml
Welcome to the classpath-hell :-). 欢迎来到classpath-hell :-)。 With the information you provide I can't really see where this error appears but I guess somewhere within a flink-operator you try to use an ObjectMapper to marshal/unmarshal some data.
根据您提供的信息,我无法真正看到此错误出现的位置,但是我想您会在flink运算符中的某个位置尝试使用ObjectMapper来编组/解组某些数据。 I would recommend you to check what (which jackson version) is on your yarn classpath.
我建议您检查一下纱线类路径上的内容(哪个杰克逊版本)。 If you need a specific version of jackson build a fat-jar with a shaded jackson version.
如果您需要特定版本的杰克逊,请使用阴影杰克逊版本构建胖子罐。 If not play the easy game and take whether the one which is already your yarn classpath or (maybe even easier) take the one flink already shaded for you: You can find under the package name:
org.apache.flink.hadoop.shaded.org.codehaus.jackson.map
. 如果不是玩简单的游戏,则选择已经是您的yarn classpath的(还是可能更简单的)那条已经为您着色的flink:您可以在包名称下找到:
org.apache.flink.hadoop.shaded.org.codehaus.jackson.map
。
Hope that helps. 希望能有所帮助。
Jackson version coming from yarn was 2.9.5 and the one i was using was 2.6.7 Changing the jackson version to 2.9.5 worked for me. 来自yarn的Jackson版本是2.9.5,而我正在使用的版本是2.6.7。将jackson版本更改为2.9.5对我有用。
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.5</version>
</dependency>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.