Seatunnel运行时报错Caused by: java.lang.NoClassDefFoundError: com/mysql/cj/MysqlType

报错

java 复制代码
===============================================================================


[] 2024-11-21 16:46:27,526 ERROR org.apache.seatunnel.core.starter.SeaTunnel - Fatal Error, 

[] 2024-11-21 16:46:27,526 ERROR org.apache.seatunnel.core.starter.SeaTunnel - Please submit bug report in https://github.com/apache/seatunnel/issues

[] 2024-11-21 16:46:27,526 ERROR org.apache.seatunnel.core.starter.SeaTunnel - Reason:SeaTunnel job executed failed 

[] 2024-11-21 16:46:27,528 ERROR org.apache.seatunnel.core.starter.SeaTunnel - Exception StackTrace:org.apache.seatunnel.core.starter.exception.CommandExecuteException: SeaTunnel job executed failed
	at org.apache.seatunnel.core.starter.seatunnel.command.ClientExecuteCommand.execute(ClientExecuteCommand.java:213)
	at org.apache.seatunnel.core.starter.SeaTunnel.run(SeaTunnel.java:40)
	at org.apache.seatunnel.example.engine.SeaTunnelEngineExample.main(SeaTunnelEngineExample.java:43)
Caused by: org.apache.seatunnel.api.table.factory.FactoryException: ErrorCode:[API-06], ErrorDescription:[Factory initialize failed] - Unable to create a source for identifier 'jdbc'.
	at org.apache.seatunnel.api.table.factory.FactoryUtil.createAndPrepareSource(FactoryUtil.java:101)
	at org.apache.seatunnel.engine.core.parse.MultipleTableJobConfigParser.parseSource(MultipleTableJobConfigParser.java:375)
	at org.apache.seatunnel.engine.core.parse.MultipleTableJobConfigParser.parse(MultipleTableJobConfigParser.java:209)
	at org.apache.seatunnel.engine.client.job.ClientJobExecutionEnvironment.getLogicalDag(ClientJobExecutionEnvironment.java:114)
	at org.apache.seatunnel.engine.client.job.ClientJobExecutionEnvironment.execute(ClientJobExecutionEnvironment.java:182)
	at org.apache.seatunnel.core.starter.seatunnel.command.ClientExecuteCommand.execute(ClientExecuteCommand.java:160)
	... 2 more
Caused by: java.lang.NoClassDefFoundError: com/mysql/cj/MysqlType
	at org.apache.seatunnel.connectors.seatunnel.jdbc.internal.dialect.mysql.MysqlDialect.<clinit>(MysqlDialect.java:52)
	at org.apache.seatunnel.connectors.seatunnel.jdbc.internal.dialect.mysql.MySqlDialectFactory.create(MySqlDialectFactory.java:47)
	at org.apache.seatunnel.connectors.seatunnel.jdbc.internal.dialect.JdbcDialectLoader.load(JdbcDialectLoader.java:97)
	at org.apache.seatunnel.connectors.seatunnel.jdbc.internal.dialect.JdbcDialectLoader.load(JdbcDialectLoader.java:40)
	at org.apache.seatunnel.connectors.seatunnel.jdbc.source.JdbcSourceFactory.createSource(JdbcSourceFactory.java:73)
	at org.apache.seatunnel.api.table.factory.FactoryUtil.createAndPrepareSource(FactoryUtil.java:112)
	at org.apache.seatunnel.api.table.factory.FactoryUtil.createAndPrepareSource(FactoryUtil.java:74)
	... 7 more
Caused by: java.lang.ClassNotFoundException: com.mysql.cj.MysqlType
	at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
	... 14 more
 
[] 2024-11-21 16:46:27,528 ERROR org.apache.seatunnel.core.starter.SeaTunnel - 
===============================================================================



Exception in thread "main" org.apache.seatunnel.core.starter.exception.CommandExecuteException: SeaTunnel job executed failed
	at org.apache.seatunnel.core.starter.seatunnel.command.ClientExecuteCommand.execute(ClientExecuteCommand.java:213)
	at org.apache.seatunnel.core.starter.SeaTunnel.run(SeaTunnel.java:40)
	at org.apache.seatunnel.example.engine.SeaTunnelEngineExample.main(SeaTunnelEngineExample.java:43)
Caused by: org.apache.seatunnel.api.table.factory.FactoryException: ErrorCode:[API-06], ErrorDescription:[Factory initialize failed] - Unable to create a source for identifier 'jdbc'.
	at org.apache.seatunnel.api.table.factory.FactoryUtil.createAndPrepareSource(FactoryUtil.java:101)
	at org.apache.seatunnel.engine.core.parse.MultipleTableJobConfigParser.parseSource(MultipleTableJobConfigParser.java:375)
	at org.apache.seatunnel.engine.core.parse.MultipleTableJobConfigParser.parse(MultipleTableJobConfigParser.java:209)
	at org.apache.seatunnel.engine.client.job.ClientJobExecutionEnvironment.getLogicalDag(ClientJobExecutionEnvironment.java:114)
	at org.apache.seatunnel.engine.client.job.ClientJobExecutionEnvironment.execute(ClientJobExecutionEnvironment.java:182)
	at org.apache.seatunnel.core.starter.seatunnel.command.ClientExecuteCommand.execute(ClientExecuteCommand.java:160)
	... 2 more
Caused by: java.lang.NoClassDefFoundError: com/mysql/cj/MysqlType
	at org.apache.seatunnel.connectors.seatunnel.jdbc.internal.dialect.mysql.MysqlDialect.<clinit>(MysqlDialect.java:52)
	at org.apache.seatunnel.connectors.seatunnel.jdbc.internal.dialect.mysql.MySqlDialectFactory.create(MySqlDialectFactory.java:47)
	at org.apache.seatunnel.connectors.seatunnel.jdbc.internal.dialect.JdbcDialectLoader.load(JdbcDialectLoader.java:97)
	at org.apache.seatunnel.connectors.seatunnel.jdbc.internal.dialect.JdbcDialectLoader.load(JdbcDialectLoader.java:40)
	at org.apache.seatunnel.connectors.seatunnel.jdbc.source.JdbcSourceFactory.createSource(JdbcSourceFactory.java:73)
	at org.apache.seatunnel.api.table.factory.FactoryUtil.createAndPrepareSource(FactoryUtil.java:112)
	at org.apache.seatunnel.api.table.factory.FactoryUtil.createAndPrepareSource(FactoryUtil.java:74)
	... 7 more
Caused by: java.lang.ClassNotFoundException: com.mysql.cj.MysqlType
	at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
	... 14 more

报错原因

pom中依赖的作用域有问题

解决方法

把这个注释掉然后刷新maven

这个pom的位置是

\seatunnel-2.3.8\seatunnel-connectors-v2\connector-jdbc\pom.xml

修改之后成功运行

相关推荐
岁岁岁平安15 分钟前
springboot实战(15)(注解@JsonFormat(pattern=“?“)、@JsonIgnore)
java·spring boot·后端·idea
Oak Zhang16 分钟前
TheadLocal出现的内存泄漏具体泄漏的是什么?弱引用在里面有什么作用?什么情景什么问题?
java·系统安全
数据小小爬虫19 分钟前
如何利用Java爬虫获得1688店铺详情
java·开发语言
天若有情67320 分钟前
c++框架设计展示---提高开发效率!
java·c++·算法
Reese_Cool38 分钟前
【数据结构与算法】排序
java·c语言·开发语言·数据结构·c++·算法·排序算法
TheITSea1 小时前
云服务器宝塔安装静态网页 WordPress、VuePress流程记录
java·服务器·数据库
AuroraI'ncoding2 小时前
SpringMVC接收请求参数
java
九圣残炎2 小时前
【从零开始的LeetCode-算法】3354. 使数组元素等于零
java·算法·leetcode
天天扭码2 小时前
五天SpringCloud计划——DAY1之mybatis-plus的使用
java·spring cloud·mybatis
程序猿小柒3 小时前
leetcode hot100【LeetCode 4.寻找两个正序数组的中位数】java实现
java·算法·leetcode