zhangzhao created FLINK-20540:
--------------------------------- Summary: Failed connecting to jdbc:postgresql://flink-postgres.cdn-flink:5432flink via JDBC Key: FLINK-20540 URL: https://issues.apache.org/jira/browse/FLINK-20540 Project: Flink Issue Type: Bug Components: Connectors / JDBC Affects Versions: 1.11.1, 1.12.0 Reporter: zhangzhao {code:java} //代码占位符 import org.apache.flink.connector.jdbc.catalog.JdbcCatalog new JdbcCatalog(name, defaultDatabase, username, password, baseUrl){code} The baseUrl must be endswith / when instantiate JdbcCatalog. But according to [Flink document|https://ci.apache.org/projects/flink/flink-docs-release-1.11/zh/dev/table/connectors/jdbc.html#usage-of-postgrescatalog] and code comments, baseUrl should be support format {{"jdbc:postgresql://<ip>:<port>"}} When i use baseUrl "{{jdbc:postgresql://<ip>:<port>}}", the error stack is: {code:java} //代码占位符 org.apache.flink.runtime.webmonitor.handlers.JarRunHandler.lambda$handleRequest$1(JarRunHandler.java:103) java.util.concurrent.CompletableFuture.uniHandle(CompletableFuture.java:836) java.util.concurrent.CompletableFuture$UniHandle.tryFire(CompletableFuture.java:811) java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:488) java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1609) java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) java.util.concurrent.FutureTask.run(FutureTask.java:266) java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) java.lang.Thread.run(Thread.java:748)\\nCaused by: java.util.concurrent.CompletionException: org.apache.flink.util.FlinkRuntimeException: Could not execute application. java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:273) java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:280) java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1606)\\n\\t... 7 more\\nCaused by: org.apache.flink.util.FlinkRuntimeException: Could not execute application. org.apache.flink.client.deployment.application.DetachedApplicationRunner.tryExecuteJobs(DetachedApplicationRunner.java:81) org.apache.flink.client.deployment.application.DetachedApplicationRunner.run(DetachedApplicationRunner.java:67) org.apache.flink.runtime.webmonitor.handlers.JarRunHandler.lambda$handleRequest$0(JarRunHandler.java:100) java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1604)\\n\\t... 7 more\\nCaused by: org.apache.flink.client.program.ProgramInvocationException: The main method caused an error: Failed connecting to jdbc:postgresql://flink-postgres.cdn-flink:5432flink via JDBC. org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:302) org.apache.flink.client.program.PackagedProgram.invokeInteractiveModeForExecution(PackagedProgram.java:198) org.apache.flink.client.ClientUtils.executeProgram(ClientUtils.java:149) org.apache.flink.client.deployment.application.DetachedApplicationRunner.tryExecuteJobs(DetachedApplicationRunner.java:78)\\n\\t... 10 more\\nCaused by: org.apache.flink.table.api.ValidationException: Failed connecting to jdbc:postgresql://flink-postgres.cdn-flink:5432flink via JDBC. org.apache.flink.connector.jdbc.catalog.AbstractJdbcCatalog.open(AbstractJdbcCatalog.java:100) org.apache.flink.table.catalog.CatalogManager.registerCatalog(CatalogManager.java:191) org.apache.flink.table.api.internal.TableEnvImpl.registerCatalog(TableEnvImpl.scala:267) com.upai.jobs.TableBodySentFields.registerCatalog(TableBodySentFields.scala:25) com.upai.jobs.FusionGifShow$.run(FusionGifShow.scala:28) com.upai.jobs.FlinkTask$.delayedEndpoint$com$upai$jobs$FlinkTask$1(FlinkTask.scala:41) com.upai.jobs.FlinkTask$delayedInit$body.apply(FlinkTask.scala:11) scala.Function0$class.apply$mcV$sp(Function0.scala:34) scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12) scala.App$$anonfun$main$1.apply(App.scala:76) scala.App$$anonfun$main$1.apply(App.scala:76) scala.collection.immutable.List.foreach(List.scala:392) scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:35) scala.App$class.main(App.scala:76) com.upai.jobs.FlinkTask$.main(FlinkTask.scala:11) com.upai.jobs.FlinkTask.main(FlinkTask.scala) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:498) org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:288)\\n\\t... 13 more\\nCaused by: java.sql.SQLException: No suitable driver found for jdbc:postgresql://flink-postgres.cdn-flink:5432flink java.sql.DriverManager.getConnection(DriverManager.java:689) java.sql.DriverManager.getConnection(DriverManager.java:247) org.apache.flink.connector.jdbc.catalog.AbstractJdbcCatalog.open(AbstractJdbcCatalog.java:97)\\n\\t... 33 more\\n\"]}" {code} 相关代码以及 -- This message was sent by Atlassian Jira (v8.3.4#803005) |
Free forum by Nabble | Edit this page |