运行flink报错:
查找思路:
(1)查看flink/log下的日志发现:
The file .flink-runtime.version.properties has not been generated correctly. You MUST run 'mvn generate-sources' in the flink-runtime module. : java.time.format.DateTimeParseException: Text '2020-12-02T08:49:16+0100' could not be parsed: Unable to obtain Instant from TemporalAccessor: {OffsetSeconds=3600},ISO resolved to 2020-12-02T08:49:16 of type java.time.format.Parsed
(2)去 flink-runtime module查看源码:
其中FAIL_MESSAGE就是“.flink-runtime.version.properties has not been ......”,仔细看源码发现该报错信息跟文件是否存在并没有关系(因为是DateTimeParseException下的错误输出),后来发现在flink/lib/flink-dist_2.11-1.12.0.jar中存在.flink-runtime.version.properties文件
解决办法:
既然是时间解析有问题,那最简单的就是直接使用默认值,不从.flink-runtime.version.properties里面读取,所以我直接删除了flink-dist_2.11-1.12.0.jar .flink-runtime.version.properties里面的git.commit.time和git.build.time配置,然后重新打成jar包,修改jar包可参考:https://www.pianshen.com/article/3728970379/
之后再运行./bin/flink命令不再报错