一、背景

             
采用maven的插件maven-shade-plugin打包时把代码和引用jar都打包一起,然后运行时正常,maven-shade-plugin插件打包出jar太大了,采用maven-jar-plugin打包分离jar和代码,运行起来出现下面错误

      二、错误
Unable to create a sink for writing table
'default_catalog.default_database.kafka_test'. Table options are:
'connector'='kafka' 'key.fields'='id' 'key.format'='json'
'properties.bootstrap.servers'='127.0.0.1:9092'
'scan.startup.mode'='latest-offset' 'topic'='test' 'value.format'='my-json'
2021-12-18 17:33:03,648 WARN
org.apache.flink.client.deployment.application.ApplicationDispatcherBootstrap
[] - Application failed unexpectedly: java.util.concurrent.CompletionException:
org.apache.flink.client.deployment.application.ApplicationExecutionException:
The application contains no execute() calls. at
java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:292)
~[?:1.8.0_151] at
java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:308)
~[?:1.8.0_151] at
java.util.concurrent.CompletableFuture.uniCompose(CompletableFuture.java:943)
~[?:1.8.0_151] at
java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:926)
~[?:1.8.0_151] at
java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:474)
~[?:1.8.0_151] at
java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:1977)
~[?:1.8.0_151] at
org.apache.flink.client.deployment.application.ApplicationDispatcherBootstrap.runApplicationEntryPoint(ApplicationDispatcherBootstrap.java:250)
~[flink-clients_2.12-1.13.2.jar:1.13.2] at
org.apache.flink.client.deployment.application.ApplicationDispatcherBootstrap.lambda$runApplicationAsync$1(ApplicationDispatcherBootstrap.java:212)
~[flink-clients_2.12-1.13.2.jar:1.13.2] at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[?:1.8.0_151] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[?:1.8.0_151] at
org.apache.flink.runtime.concurrent.akka.ActorSystemScheduledExecutorAdapter$ScheduledFutureTask.run(ActorSystemScheduledExecutorAdapter.java:159)
[flink-runtime_2.12-1.13.2.jar:1.13.2] at
akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:40)
[akka-actor_2.12-2.5.21.jar:2.5.21] at
akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(ForkJoinExecutorConfigurator.scala:44)
[akka-actor_2.12-2.5.21.jar:2.5.21] at
akka.dispatch.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
[akka-actor_2.12-2.5.21.jar:2.5.21] at
akka.dispatch.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
[akka-actor_2.12-2.5.21.jar:2.5.21] at
akka.dispatch.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
[akka-actor_2.12-2.5.21.jar:2.5.21] at
akka.dispatch.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
[akka-actor_2.12-2.5.21.jar:2.5.21] Caused by:
org.apache.flink.client.deployment.application.ApplicationExecutionException:
The application contains no execute() calls. ... 11 more 2021-12-18
17:33:03,655 ERROR org.apache.flink.runtime.entrypoint.ClusterEntrypoint [] -
Fatal error occurred in the cluster entrypoint.
org.apache.flink.util.FlinkException: Application failed unexpectedly. at
org.apache.flink.client.deployment.application.ApplicationDispatcherBootstrap.lambda$runApplicationAndShutdownClusterAsync$0(ApplicationDispatcherBootstrap.java:170)
~[flink-clients_2.12-1.13.2.jar:1.13.2] at
java.util.concurrent.CompletableFuture.uniHandle(CompletableFuture.java:822)
~[?:1.8.0_151] at
java.util.concurrent.CompletableFuture$UniHandle.tryFire(CompletableFuture.java:797)
~[?:1.8.0_151] at
java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:474)
~[?:1.8.0_151] at
java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:1977)
~[?:1.8.0_151] at
org.apache.flink.client.deployment.application.ApplicationDispatcherBootstrap.runApplicationEntryPoint(ApplicationDispatcherBootstrap.java:250)
~[flink-clients_2.12-1.13.2.jar:1.13.2] at
org.apache.flink.client.deployment.application.ApplicationDispatcherBootstrap.lambda$runApplicationAsync$1(ApplicationDispatcherBootstrap.java:212)
~[flink-clients_2.12-1.13.2.jar:1.13.2] at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[?:1.8.0_151] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[?:1.8.0_151] at
org.apache.flink.runtime.concurrent.akka.ActorSystemScheduledExecutorAdapter$ScheduledFutureTask.run(ActorSystemScheduledExecutorAdapter.java:159)
[flink-runtime_2.12-1.13.2.jar:1.13.2] at
akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:40)
[akka-actor_2.12-2.5.21.jar:2.5.21] at
akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(ForkJoinExecutorConfigurator.scala:44)
[akka-actor_2.12-2.5.21.jar:2.5.21] at
akka.dispatch.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
[akka-actor_2.12-2.5.21.jar:2.5.21] at
akka.dispatch.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
[akka-actor_2.12-2.5.21.jar:2.5.21] at
akka.dispatch.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
[akka-actor_2.12-2.5.21.jar:2.5.21] at
akka.dispatch.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
[akka-actor_2.12-2.5.21.jar:2.5.21] Caused by:
java.util.concurrent.CompletionException:
org.apache.flink.client.deployment.application.ApplicationExecutionException:
The application contains no execute() calls. at
java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:292)
~[?:1.8.0_151] at
java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:308)
~[?:1.8.0_151] at
java.util.concurrent.CompletableFuture.uniCompose(CompletableFuture.java:943)
~[?:1.8.0_151] at
java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:926)
~[?:1.8.0_151]
 三、分析错误

         错误提示Unable to create a sink for writing table
'default_catalog.default_database.kafka_test'. 
说明是不能写入,原先以为是缺少kafka的jar,这边没提示缺少jar

        接下去提示Table options
are,我怀疑是里面参数有什么问题,我参数一个一个对比过去,发现'value.format'='my-json'这个参数,是我自己代码构建的,所以发现注册的这个配置没打包上来

所以我重新打包上来就正常。

    总结:提示的错误不是很明显,排查比较久,还是慢慢分析,还是能发现问题     

技术
下载桌面版
GitHub
Gitee
SourceForge
百度网盘(提取码:draw)
云服务器优惠
华为云优惠券
腾讯云优惠券
阿里云优惠券
Vultr优惠券
站点信息
问题反馈
邮箱:[email protected]
吐槽一下
QQ群:766591547
关注微信