Hi, According to https://ci.apache.org/projects/flink/flink-docs-release-1.11/dev/table/connectors/filesystem.html, avro is supported for table API but below code failed: tEnv.executeSql("CREATE TABLE people (\n" + But got: Caused by: org.apache.flink.client.program.ProgramInvocationException: The main method caused an error: Could not find any factory for identifier 'avro' that implements 'org.apache.flink.table.factories.FileSystemFormatFactory' in the classpath. jobmanager_1 | jobmanager_1 | Available factory identifiers are: jobmanager_1 | jobmanager_1 | csv jobmanager_1 | json jobmanager_1 | parquet jobmanager_1 | at org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:302) ~[flink-dist_2.11-1.11.0.jar:1.11.0] jobmanager_1 | at org.apache.flink.client.program.PackagedProgram.invokeInteractiveModeForExecution(PackagedProgram.java:198) ~[flink-dist_2.11-1.11.0.jar:1.11.0] jobmanager_1 | at org.apache.flink.client.ClientUtils.executeProgram(ClientUtils.java:149) ~[flink-dist_2.11-1.11.0.jar:1.11.0] jobmanager_1 | at org.apache.flink.client.deployment.application.ApplicationDispatcherBootstrap.runApplicationEntryPoint(ApplicationDispatcherBootstrap.java:230) ~[flink-dist_2.11-1.11.0.jar:1.11.0] jobmanager_1 | ... 10 more jobmanager_1 | Caused by: org.apache.flink.table.api.ValidationException: Could not find any factory for identifier 'avro' that implements 'org.apache.flink.table.factories.FileSystemFormatFactory' in the classpath. Any idea? Thanks! Regards Leon |
You are missing additional dependencies Am 11.07.2020 um 04:16 schrieb Lian Jiang <[hidden email]>:
|
Thanks Jörn! I added the documented dependency in my pom.xml file:
The newly generated jar does have: $ jar tf target//spend-report-1.0.0.jar | grep FileSystemFormatFactory org/apache/flink/formats/parquet/ParquetFileSystemFormatFactory.class org/apache/flink/formats/parquet/ParquetFileSystemFormatFactory$ParquetInputFormat.class org/apache/flink/formats/avro/AvroFileSystemFormatFactory$RowDataAvroWriterFactory$1.class org/apache/flink/formats/avro/AvroFileSystemFormatFactory$RowDataAvroWriterFactory.class org/apache/flink/formats/avro/AvroFileSystemFormatFactory$RowDataAvroInputFormat.class org/apache/flink/formats/avro/AvroFileSystemFormatFactory.class org/apache/flink/formats/avro/AvroFileSystemFormatFactory$1.class But still got the same error. Anything else is missing? Thanks. Regards! More detailed exception: jobmanager_1 | Caused by: org.apache.flink.client.program.ProgramInvocationException: The main method caused an error: Could not find any factory for identifier 'avro' that implements 'org.apache.flink.table.factories.FileSystemFormatFactory' in the classpath. jobmanager_1 | jobmanager_1 | Available factory identifiers are: jobmanager_1 | jobmanager_1 | csv jobmanager_1 | json jobmanager_1 | parquet jobmanager_1 | at org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:302) ~[flink-dist_2.11-1.11.0.jar:1.11.0] jobmanager_1 | at org.apache.flink.client.program.PackagedProgram.invokeInteractiveModeForExecution(PackagedProgram.java:198) ~[flink-dist_2.11-1.11.0.jar:1.11.0] jobmanager_1 | at org.apache.flink.client.ClientUtils.executeProgram(ClientUtils.java:149) ~[flink-dist_2.11-1.11.0.jar:1.11.0] jobmanager_1 | at org.apache.flink.client.deployment.application.ApplicationDispatcherBootstrap.runApplicationEntryPoint(ApplicationDispatcherBootstrap.java:230) ~[flink-dist_2.11-1.11.0.jar:1.11.0] jobmanager_1 | ... 10 more jobmanager_1 | Caused by: org.apache.flink.table.api.ValidationException: Could not find any factory for identifier 'avro' that implements 'org.apache.flink.table.factories.FileSystemFormatFactory' in the classpath. jobmanager_1 | jobmanager_1 | Available factory identifiers are: jobmanager_1 | jobmanager_1 | csv jobmanager_1 | json jobmanager_1 | parquet jobmanager_1 | at org.apache.flink.table.factories.FactoryUtil.discoverFactory(FactoryUtil.java:240) ~[flink-table-blink_2.11-1.11.0.jar:1.11.0] jobmanager_1 | at org.apache.flink.table.filesystem.FileSystemTableFactory.createFormatFactory(FileSystemTableFactory.java:112) ~[flink-table-blink_2.11-1.11.0.jar:1.11.0] jobmanager_1 | at org.apache.flink.table.filesystem.FileSystemTableSource.getInputFormat(FileSystemTableSource.java:143) ~[flink-table-blink_2.11-1.11.0.jar:1.11.0] jobmanager_1 | at org.apache.flink.table.filesystem.FileSystemTableSource.getDataStream(FileSystemTableSource.java:127) ~[flink-table-blink_2.11-1.11.0.jar:1.11.0] jobmanager_1 | at org.apache.flink.table.planner.plan.nodes.physical.PhysicalLegacyTableSourceScan.getSourceTransformation(PhysicalLegacyTableSourceScan.scala:82) ~[flink-table-blink_2.11-1.11.0.jar:1.11.0] jobmanager_1 | at org.apache.flink.table.planner.plan.nodes.physical.stream.StreamExecLegacyTableSourceScan.translateToPlanInternal(StreamExecLegacyTableSourceScan.scala:98) ~[flink-table-blink_2.11-1.11.0.jar:1.11.0] jobmanager_1 | at org.apache.flink.table.planner.plan.nodes.physical.stream.StreamExecLegacyTableSourceScan.translateToPlanInternal(StreamExecLegacyTableSourceScan.scala:63) ~[flink-table-blink_2.11-1.11.0.jar:1.11.0] jobmanager_1 | at org.apache.flink.table.planner.plan.nodes.exec.ExecNode$class.translateToPlan(ExecNode.scala:58) ~[flink-table-blink_2.11-1.11.0.jar:1.11.0] jobmanager_1 | at org.apache.flink.table.planner.plan.nodes.physical.stream.StreamExecLegacyTableSourceScan.translateToPlan(StreamExecLegacyTableSourceScan.scala:63) ~[flink-table-blink_2.11-1.11.0.jar:1.11.0] jobmanager_1 | at org.apache.flink.table.planner.plan.nodes.physical.stream.StreamExecSink.translateToPlanInternal(StreamExecSink.scala:79) ~[flink-table-blink_2.11-1.11.0.jar:1.11.0] jobmanager_1 | at org.apache.flink.table.planner.plan.nodes.physical.stream.StreamExecSink.translateToPlanInternal(StreamExecSink.scala:43) ~[flink-table-blink_2.11-1.11.0.jar:1.11.0] jobmanager_1 | at org.apache.flink.table.planner.plan.nodes.exec.ExecNode$class.translateToPlan(ExecNode.scala:58) ~[flink-table-blink_2.11-1.11.0.jar:1.11.0] jobmanager_1 | at org.apache.flink.table.planner.plan.nodes.physical.stream.StreamExecSink.translateToPlan(StreamExecSink.scala:43) ~[flink-table-blink_2.11-1.11.0.jar:1.11.0] jobmanager_1 | at org.apache.flink.table.planner.delegation.StreamPlanner$$anonfun$translateToPlan$1.apply(StreamPlanner.scala:67) ~[flink-table-blink_2.11-1.11.0.jar:1.11.0] jobmanager_1 | at org.apache.flink.table.planner.delegation.StreamPlanner$$anonfun$translateToPlan$1.apply(StreamPlanner.scala:66) ~[flink-table-blink_2.11-1.11.0.jar:1.11.0] jobmanager_1 | at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234) ~[flink-dist_2.11-1.11.0.jar:1.11.0] jobmanager_1 | at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234) ~[flink-dist_2.11-1.11.0.jar:1.11.0] jobmanager_1 | at scala.collection.Iterator$class.foreach(Iterator.scala:891) ~[flink-dist_2.11-1.11.0.jar:1.11.0] jobmanager_1 | at scala.collection.AbstractIterator.foreach(Iterator.scala:1334) ~[flink-dist_2.11-1.11.0.jar:1.11.0] jobmanager_1 | at scala.collection.IterableLike$class.foreach(IterableLike.scala:72) ~[flink-dist_2.11-1.11.0.jar:1.11.0] jobmanager_1 | at scala.collection.AbstractIterable.foreach(Iterable.scala:54) ~[flink-dist_2.11-1.11.0.jar:1.11.0] jobmanager_1 | at scala.collection.TraversableLike$class.map(TraversableLike.scala:234) ~[flink-dist_2.11-1.11.0.jar:1.11.0] jobmanager_1 | at scala.collection.AbstractTraversable.map(Traversable.scala:104) ~[flink-dist_2.11-1.11.0.jar:1.11.0] jobmanager_1 | at org.apache.flink.table.planner.delegation.StreamPlanner.translateToPlan(StreamPlanner.scala:66) ~[flink-table-blink_2.11-1.11.0.jar:1.11.0] jobmanager_1 | at org.apache.flink.table.planner.delegation.PlannerBase.translate(PlannerBase.scala:166) ~[flink-table-blink_2.11-1.11.0.jar:1.11.0] jobmanager_1 | at org.apache.flink.table.api.internal.TableEnvironmentImpl.translate(TableEnvironmentImpl.java:1248) ~[flink-table-blink_2.11-1.11.0.jar:1.11.0] jobmanager_1 | at org.apache.flink.table.api.internal.TableEnvironmentImpl.executeInternal(TableEnvironmentImpl.java:694) ~[flink-table-blink_2.11-1.11.0.jar:1.11.0] jobmanager_1 | at org.apache.flink.table.api.internal.TableImpl.executeInsert(TableImpl.java:565) ~[flink-table-blink_2.11-1.11.0.jar:1.11.0] jobmanager_1 | at org.apache.flink.table.api.internal.TableImpl.executeInsert(TableImpl.java:549) ~[flink-table-blink_2.11-1.11.0.jar:1.11.0] jobmanager_1 | at org.apache.flink.playgrounds.spendreport.SpendReport.localavro_mysql(SpendReport.java:220) ~[?:?] jobmanager_1 | at org.apache.flink.playgrounds.spendreport.SpendReport.main(SpendReport.java:31) ~[?:?] jobmanager_1 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_252] jobmanager_1 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_252] jobmanager_1 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_252] jobmanager_1 | at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_252] jobmanager_1 | at org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:288) ~[flink-dist_2.11-1.11.0.jar:1.11.0] jobmanager_1 | at org.apache.flink.client.program.PackagedProgram.invokeInteractiveModeForExecution(PackagedProgram.java:198) ~[flink-dist_2.11-1.11.0.jar:1.11.0] jobmanager_1 | at org.apache.flink.client.ClientUtils.executeProgram(ClientUtils.java:149) ~[flink-dist_2.11-1.11.0.jar:1.11.0] jobmanager_1 | at org.apache.flink.client.deployment.application.ApplicationDispatcherBootstrap.runApplicationEntryPoint(ApplicationDispatcherBootstrap.java:230) ~[flink-dist_2.11-1.11.0.jar:1.11.0] On Sat, Jul 11, 2020 at 12:33 AM Jörn Franke <[hidden email]> wrote:
-- |
i am using flink playground as the base: I observed "PhysicalLegacyTableSourceScan". Not sure whether this is related. Thanks. Regards! On Sat, Jul 11, 2020 at 3:43 PM Lian Jiang <[hidden email]> wrote:
-- |
It seems that you don't add additional dependencies. <dependency> <groupId>org.apache.avro</groupId> <artifactId>avro</artifactId> <version>1.8.2</version> </dependency> Lian Jiang <[hidden email]> 于2020年7月12日周日 下午1:08写道:
|
In reply to this post by Lian Jiang
Hi, Jiang
After added the flink-avro dependency, did you restart your cluster/sql-client? It looks flink-avro dependency did not load properly from the log.
Best, Leonard Xu |
Thanks guys. I missed the runtime dependencies. After adding below into https://github.com/apache/flink-playgrounds/blob/master/table-walkthrough/Dockerfile. The original issue of "Could not find any factory for identifier" is gone. wget -P /opt/flink/lib/ https://repo1.maven.org/maven2/org/apache/flink/flink-avro/1.11.0/flink-avro-1.11.0.jar; \ Is there a uber jar or a list of runtime dependencies so that developers can easily make the above example of Flink SQL for avro work? Thanks. On Sat, Jul 11, 2020 at 11:39 PM Leonard Xu <[hidden email]> wrote:
-- |
From the latest exception message, it seems that the avro factory problem has been resolved. The new exception indicates that you don't have proper Apache Avro dependencies (because flink-avro doesn't bundle Apache Avro), so you have to add Apache Avro into your project dependency, or export HADOOP_CLASSPATH if hadoop is installed in your environment. <dependency> <groupId>org.apache.avro</groupId> <artifactId>avro</artifactId> <version>1.8.2</version> </dependency> Best, Jark On Mon, 13 Jul 2020 at 03:04, Lian Jiang <[hidden email]> wrote:
|
In reply to this post by Lian Jiang
Hi, Jiang
Best, Leonard Xu |
Thanks Leonard and Jark. Here is my repo for your repro: https://bitbucket.org/jiangok/flink-playgrounds/src/0d242a51f02083711218d3810267117e6ce4260c/table-walkthrough/pom.xml#lines-131. As you can see, my pom.xml has already added flink-avro and avro dependencies. You can run this repro by: git clone [hidden email]:jiangok/flink-playgrounds.git cd flink-playgrounds/table-walkthrough . scripts/ops.sh # this script has some helper commands. rebuild # this will build artifacts, docker and run. log jobmanager # this will print job manager log which has the exception. Appreciate very much for your help! table-walkthroughOn Sun, Jul 12, 2020 at 8:00 PM Leonard Xu <[hidden email]> wrote:
-- |
Free forum by Nabble | Edit this page |