I have a streaming Table API query and want to write the resulting Table
into a .csv
file using the table.writetoSink(sink)
method.
When I run the program, I got the following error.
Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/commons/compiler/CompileException
at org.apache.calcite.sql2rel.SqlToRelConverter.convertQuery(SqlToRelConverter.java:580)
at org.apache.flink.api.table.FlinkPlannerImpl.rel(FlinkPlannerImpl.scala:102)
at org.apache.flink.api.table.BatchTableEnvironment.sql(BatchTableEnvironment.scala:132)
at table_streaming_test.main(table_streaming_test.java:59)
Caused by: java.lang.ClassNotFoundException: org.codehaus.commons.compiler.CompileException
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 4 more
I have also included the commons-compiler.jar file in my project.
Flink's Table and SQL API is built on Apache Calcite which depends on
commons-compiler
fromorg.codehaus.janino
.The error message suggests that the
commons-compiler
dependency is not included in your application. One approach is to built a fat jar containing all dependencies of your application. Flink's quickstart Maven architypes (Java and Scala) provide a blueprint for that. Another approach is to add all required dependencies to the./lib
folder of your Flink setup.