1、报错记录:
Caused by: java.lang.NoClassDefFoundError: scala/util/parsing/combinator/Parsers$class
at org.apache.flink.table.expressions.ExpressionParser$.<init>(ExpressionParser.scala:40)
at org.apache.flink.table.expressions.ExpressionParser$.<clinit>(ExpressionParser.scala)
at org.apache.flink.table.api.java.StreamTableEnvironment.registerDataStream(StreamTableEnvironment.scala:128)
at com.ly.engine.Engine.main(Engine.java:32)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:529)
at org.apache.flink.client.program.PackagedProgram.invokeInteractiveModeForExecution(PackagedProgram.java:421)
at org.apache.flink.client.program.OptimizerPlanEnvironment.getOptimizedPlan(OptimizerPlanEnvironment.java:83)
... 8 more
Caused by: java.lang.ClassNotFoundException: scala.util.parsing.combinator.Parsers$class
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 19 more
还有可能是
Caused by: java.lang.NoSuchMethodError: scala.Predef$.refArrayOps([Ljava/lang/Object;)Lscala/collection/mutable/ArrayOps;
at org.apache.flink.table.api.TableEnvironment$.getFieldNames(TableEnvironment.scala:1360)
at org.apache.flink.table.api.TableEnvironment.getFieldInfo(TableEnvironment.scala:1035)
at org.apache.flink.table.api.StreamTableEnvironment.registerDataStreamInternal(StreamTableEnvironment.scala:519)
at org.apache.flink.table.api.java.StreamTableEnvironment.registerDataStream(StreamTableEnvironment.scala:107)
at com.ly.engine.Engine.main(Engine.java:32)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:529)
at org.apache.flink.client.program.PackagedProgram.invokeInteractiveModeForExecution(PackagedProgram.java:421)
at org.apache.flink.client.program.OptimizerPlanEnvironment.getOptimizedPlan(OptimizerPlanEnvironment.java:83)
... 8 more
2、解决办法:
第一次想到的是看官方文档看依赖加载,一看官网:
这依赖加载和我本地版本一模一样,就是启动不了。然后看了下运行环境的flink的版本也对应。于是看了下运行flink的依赖,在安装目录的lib和opt下面。lib下面是没有和table相关的依赖了,看了下opt。
一看怎么是table和scala版本怎么是2.12版本的。看来官网文档也不是很完善啊。把几个版本改成2.12完美运行。