Hey, I am trying to create a table using a tableEn...
# troubleshooting
j
Hey, I am trying to create a table using a tableEnv query where connector='kafka'. It works through main(), but when uploading and running the Job through JM API it fails with the following:
Copy code
org.apache.flink.client.program.ProgramInvocationException: The main method caused an error: Unable to create a sink for writing table 'default_catalog.default_database.FlinkStatesTable'.
and
Copy code
flinkstates-jobmanager-1   | Caused by: org.apache.flink.table.api.ValidationException: Could not find any factory for identifier 'kafka' that implements 'org.apache.flink.table.factories.DynamicTableFactory' in the classpath.
flinkstates-jobmanager-1   |
flinkstates-jobmanager-1   | Available factory identifiers are:
flinkstates-jobmanager-1   |
flinkstates-jobmanager-1   | blackhole
flinkstates-jobmanager-1   | datagen
flinkstates-jobmanager-1   | filesystem
flinkstates-jobmanager-1   | print
I've made sure that the `flink-connector-kafka-3.0.1-1.18.jar`is present in the classpath. Running java 17 Flink 1.18.0 Any ideas are greatly appreciated.
m
How have you added the Flink Kafka connector in your project / to your server?
j
Its in the pom.xml of my Job and added in the Dockerfile for building my JM and TM with
Copy code
ADD https://repo1.maven.org/maven2/org/apache/flink/flink-connector-kafka/3.0.1-1.18/flink-connector-kafka-3.0.1-1.18.jar /opt/flink/lib/flink-connector-kafka-3.0.1-1.18.jar
m
So are you experiencing this when running from the IDE, or when submitting the job to your Docker env?
j
When I submit the jar and run it, the exception is thrown in my IDE terminal.
m
Have you set the scope to provided? And if so, have you ticked the box that makes sure that dependencies that are marked as provided are added to the classpath?
j
Should every sql dependendency scope be set to provided or just the connector?
When I changed the connector scope from compile to provided I got:
Copy code
flinkstates-jobmanager-1   | 2023-12-14 12:19:23,560 ERROR org.apache.flink.runtime.webmonitor.handlers.JarRunHandler   [] - Exception occurred in REST handler: Could not execute application.
The checkbox was already ticked.