data-engineer-handbook
data-engineer-handbook copied to clipboard
IllegalStateException caused by incorrect JDBC URL format in `example.env`
When I run the command:
make job
or
docker compose exec jobmanager ./bin/flink run -py /opt/src/job/start_job.py --pyFiles /opt/src -d
The application fails to start due to an IllegalStateException
Caused by: java.lang.IllegalStateException: Could not find any jdbc dialect factory that can handle url '"jdbc:postgresql://host.docker.internal:5432/postgres"' that implements 'org.apache.flink.connector.jdbc.dialect.JdbcDialectFactory' in the classpath.
Available factories are:
org.apache.flink.connector.jdbc.dialect.derby.DerbyDialectFactory
org.apache.flink.connector.jdbc.dialect.mysql.MySqlDialectFactory
org.apache.flink.connector.jdbc.dialect.oracle.OracleDialectFactory
org.apache.flink.connector.jdbc.dialect.psql.PostgresDialectFactory
at org.apache.flink.connector.jdbc.dialect.JdbcDialectLoader.load(JdbcDialectLoader.java:64)
at org.apache.flink.connector.jdbc.table.JdbcDynamicTableFactory.validateConfigOptions(JdbcDynamicTableFactory.java:270)
at org.apache.flink.connector.jdbc.table.JdbcDynamicTableFactory.createDynamicTableSink(JdbcDynamicTableFactory.java:90)
at org.apache.flink.table.factories.FactoryUtil.createDynamicTableSink(FactoryUtil.java:267)
... 29 more
The issue is caused by an incorrect JDBC URL format in the example.env file. The error message indicates that the URL is not recognized by the JdbcDialectLoader.
Probably extra double quotes around the POSTGRES_URL value in the example.env file it's the problem. Whe I remove the double quotes like this:
...
POSTGRES_URL=jdbc:postgresql://host.docker.internal:5432/postgres
JDBC_BASE_URL=jdbc:postgresql://host.docker.internal:5432
The issue is solved. So I suggest to update the example.env file to prevent this issue in the future.