Tag Archives: Flink (Java 与 Scala)

NoClassDefFoundError: org/apache/flink/metrics/MetricGroup

. So we have this problem :

Exception in thread “main” java.lang.NoClassDefFoundError: Org/apache/flink/metrics/MetricGroup
the at org. Apache. The flink. Streaming. API. Environment. StreamExecutionEnvironment. AddSource StreamExecutionEnvironment. Java: (1614)
the at Org. Apache. Flink, streaming API. Environment. StreamExecutionEnvironment. FromCollection (StreamExecutionEnvironment. Java: 975)
the at Org. Apache. Flink, streaming API. Environment. StreamExecutionEnvironment. FromCollection (StreamExecutionEnvironment. Java: 945)
at the Map. The main (Map) Java: 22)
under Caused by: java.lang.ClassNotFoundException: Org. Apache. Flink. Metrics. MetricGroup
the at java.net.URLClassLoader.findClass (URLClassLoader. Java: 381)
the at Java lang. This. The loadClass (424). This Java:
the at Sun. Misc. The Launcher $AppClassLoader. LoadClass (335). The Launcher Java:
the at Java lang. This. LoadClass (357). This Java:
… 4 more

obviously the first thing to do is go to $FLINK_HOME and type in

grep -r MetricGroup

returns

flink – dist_2. 11-1.12 – the SNAPSHOT. Jar
Flink-dist

is not found in mvnrepository.com

is really no way, stuck for a long time, the last way is as follows :

import flink-dist-***.jar

directly in Project Structure under $FLINK_HOME/lib

then run the code again, problem solved.