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

修改之后成功运行

相关推荐
winks32 分钟前
Spring Task的使用
java·后端·spring
秋意钟13 分钟前
Spring新版本
java·后端·spring
椰椰椰耶15 分钟前
【文档搜索引擎】缓冲区优化和索引模块小结
java·spring·搜索引擎
mubeibeinv16 分钟前
项目搭建+图片(添加+图片)
java·服务器·前端
青莳吖17 分钟前
Java通过Map实现与SQL中的group by相同的逻辑
java·开发语言·sql
Buleall25 分钟前
期末考学C
java·开发语言
重生之绝世牛码27 分钟前
Java设计模式 —— 【结构型模式】外观模式详解
java·大数据·开发语言·设计模式·设计原则·外观模式
小蜗牛慢慢爬行33 分钟前
有关异步场景的 10 大 Spring Boot 面试问题
java·开发语言·网络·spring boot·后端·spring·面试
新手小袁_J1 小时前
JDK11下载安装和配置超详细过程
java·spring cloud·jdk·maven·mybatis·jdk11
呆呆小雅1 小时前
C#关键字volatile
java·redis·c#