springboot项目里集成flink,idea本地启动项目,flink任务可以执行,打包放服务器上跑执行就报错了,flink1.19 cdc3.0.1
<groupId>org.apache.flink</groupId>
<artifactId>flink-core</artifactId>
<version>${flink.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.flink/flink-java -->
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-java</artifactId>
<version>${flink.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.flink/flink-streaming-java -->
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-streaming-java</artifactId>
<version>${flink.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.ververica/flink-cdc-runtime -->
<dependency>
<groupId>com.ververica</groupId>
<artifactId>flink-cdc-runtime</artifactId>
<version>${flink.cdc.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.flink/flink-clients -->
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-clients</artifactId>
<version>${flink.version}</version>
</dependency>
<dependency>
<groupId>com.ververica</groupId>
<artifactId>flink-connector-mysql-cdc</artifactId>
<version>${flink.cdc.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.bahir/flink-connector-redis -->
<dependency>
<groupId>org.apache.bahir</groupId>
<artifactId>flink-connector-redis_2.12</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>com.ververica</groupId>
<artifactId>flink-connector-mongodb-cdc</artifactId>
<version>${flink.cdc.version}</version>
</dependency>
<dependency>
<groupId>com.ververica</groupId>
<artifactId>flink-connector-sqlserver-cdc</artifactId>
<version>${flink.cdc.version}</version>
</dependency>
<dependency>
<groupId>com.ververica</groupId>
<artifactId>flink-connector-oracle-cdc</artifactId>
<version>${flink.cdc.version}</version>
</dependency>
<dependency>
<groupId>com.ververica</groupId>
<artifactId>flink-connector-postgres-cdc</artifactId>
<version>${flink.cdc.version}</version>
</dependency>
<dependency>
<groupId>com.ververica</groupId>
<artifactId>flink-connector-db2-cdc</artifactId>
<version>${flink.cdc.version}</version>
</dependency>
[flink-pekko.actor.default-dispatcher-9] o.a.f.r.d.StandaloneDispatcher [Dispatcher.java : 1343] Job a9f375a2c1d30edda63a04b77c979cdc reached terminal state FAILED.
org.apache.flink.runtime.client.JobInitializationException: Could not start the JobMaster.
Caused by: java.util.concurrent.CompletionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: org.apache.flink.api.common.ExecutionConfig
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: org.apache.flink.api.common.ExecutionConfig
遇到在本地IDEA中运行Flink任务正常,但在服务器上运行时报错的情况,通常与以下几个因素相关:
ClassNotFoundException: org.apache.flink.api.common.ExecutionConfig
表明可能存在类路径问题或依赖冲突。检查服务器上的应用程序包是否完整,确保所有依赖都已正确打包进去,没有遗漏。同时,确认没有其他版本的Flink库或与其冲突的库存在于服务器的类路径中。有时候,服务器上可能有全局的Maven仓库或旧版库,这些可能会干扰你的应用。flink-conf.yaml
),确保配置正确且与本地开发环境相匹配,特别是关于网络、内存、并行度等方面的设置。mvn clean package -DskipTests
,并且检查是否使用了正确的打包类型(如jar
或war
)。解决思路:
mvn dependency:tree
或Gradle的gradle dependencies
命令)确认所有依赖正确无冲突。如果以上步骤都无法解决问题,考虑将服务器上的Flink运行环境完全复刻到本地进行调试,或者进一步提供详细的错误日志进行分析。
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。
实时计算Flink版是阿里云提供的全托管Serverless Flink云服务,基于 Apache Flink 构建的企业级、高性能实时大数据处理系统。提供全托管版 Flink 集群和引擎,提高作业开发运维效率。