Exception in thread "main" java.lang.ExceptionInInitializerError
        at org.apache.flink.runtime.util.EnvironmentInformation.getVersionsInstance(EnvironmentInformation.java:184)
        at org.apache.flink.runtime.util.EnvironmentInformation.getGitCommitIdAbbrev(EnvironmentInformation.java:89)
        at org.apache.flink.runtime.util.EnvironmentInformation.getRevisionInformation(EnvironmentInformation.java:112)
        at org.apache.flink.runtime.util.EnvironmentInformation.logEnvironmentInfo(EnvironmentInformation.java:376)
        at org.apache.flink.runtime.entrypoint.StandaloneSessionClusterEntrypoint.main(StandaloneSessionClusterEntrypoint.java:45)
Caused by: java.lang.IllegalStateException: The file .flink-runtime.version.properties has not been generated correctly. You MUST run 'mvn generate-sources' in the flink-runtime module.
        at org.apache.flink.runtime.util.EnvironmentInformation$Versions.<init>(EnvironmentInformation.java:170)
        at org.apache.flink.runtime.util.EnvironmentInformation$VersionsHolder.<clinit>(EnvironmentInformation.java:180)
        ... 5 more

从apache官网下载了flink1.11.2,放到linxu下执行启动,报如上异常。

再查看日志,如下蛛丝马迹

2020-12-08 17:21:35,238 ERROR org.apache.flink.runtime.util.EnvironmentInformation         [] - 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-09-09T22:19:03+0800' could not be parsed: Unable to obtain Instant from TemporalAccessor: {OffsetSeconds=28800},ISO resolved to 2020-09-09T22:19:03 of type java.time.format.Parsed

把flink-dist_2.11-1.11.2.jar文件拉下来,把里面的.flink-runtime.version.properties文件拿出来,内容如下

# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

project.version=1.11.2
scala.binary.version=2.11

git.commit.id=fe3613574f76201a8d55d572a639a4ce7e18a9db
git.commit.id.abbrev=fe36135
git.commit.time=2020-09-09T22:19:03+0800
git.build.time=2020-09-10T11:29:48+0800

看起来git.commit.time配置没啥特别,本地跑一下也正常。

try {
            String propGitCommitTime = "2020-09-09T22:19:03+0000";
            Instant gitCommitTime = gitDateTimeFormatter.parse(propGitCommitTime, Instant::from);
            String gitCommitTimeStr = berlinDateTime.format(gitCommitTime);
            System.out.println(gitCommitTime);
            System.out.println(gitCommitTimeStr);
        } catch (Exception e) {
            e.printStackTrace();
        }

2020-09-09T22:19:03Z
2020-09-10T00:19:03+02:00

网上看一下文章 Java 8 时间解析的bug:java.time.format.DateTimeParseException: Text '20180225142051591' could not be parsed at index 0_异度社区

据说是jdk的bug [JDK-8031085] DateTimeFormatter won't parse dates with custom format "yyyyMMddHHmmssSSS" - Java Bug System

对比下本地是

java version "1.8.0_111"
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)

linux上是

java version "1.8.0_11"
Java(TM) SE Runtime Environment (build 1.8.0_11-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.11-b03, mixed mode)

立马升级linux的jdk,升级后完美启动。

Logo

瓜分20万奖金 获得内推名额 丰厚实物奖励 易参与易上手

更多推荐