问题描述
Flink 客户端程序编译时报错:
Exception in thread "main" org.apache.flink.shaded.guava18.com.google.common.util.concurrent.UncheckedExecutionException: java.lang.NumberFormatException: Not a version: 9
at org.apache.flink.shaded.guava18.com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2203)
at org.apache.flink.shaded.guava18.com.google.common.cache.LocalCache.get(LocalCache.java:3937)
at org.apache.flink.shaded.guava18.com.google.common.cache.LocalCache$LocalManualCache.get(LocalCache.java:4739)
at org.apache.flink.api.scala.typeutils.TraversableSerializer$.compileCbf(TraversableSerializer.scala:184)
at org.apache.flink.api.scala.typeutils.TraversableSerializer.compileCbf(TraversableSerializer.scala:51)
at org.apache.flink.api.scala.typeutils.TraversableSerializer.<init>(TraversableSerializer.scala:41)
at com.simwor.bigdata.UVAgg$$anon$6$$anon$5.<init>(UVAgg.scala:39)
at com.simwor.bigdata.UVAgg$$anon$6.createSerializer(UVAgg.scala:39)
at com.simwor.bigdata.UVAgg$$anon$6.createSerializer(UVAgg.scala:39)
at org.apache.flink.api.java.typeutils.PojoTypeInfo.createPojoSerializer(PojoTypeInfo.java:319)
at org.apache.flink.api.java.typeutils.PojoTypeInfo.createSerializer(PojoTypeInfo.java:311)
at org.apache.flink.streaming.api.datastream.WindowedStream.aggregate(WindowedStream.java:987)
at org.apache.flink.streaming.api.scala.WindowedStream.aggregate(WindowedStream.scala:365)
at com.simwor.bigdata.UVAgg$.main(UVAgg.scala:39)
at com.simwor.bigdata.UVAgg.main(UVAgg.scala)
解决方案
替换Scala版本 2.11.12 为 2.11.8
<!-- <dependency>-->
<!-- <groupId>org.scala-lang</groupId>-->
<!-- <artifactId>scala-library</artifactId>-->
<!-- <version>2.11.12</version>-->
<!-- <scope>provided</scope>-->
<!-- </dependency>-->
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>2.11.8</version>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-compiler</artifactId>
<version>2.11.8</version>
</dependency>
问题根因
POM Scala 版本与编译器 Scala 版本冲突