问题描述
我正在尝试将我的 SQL Server 数据库连接到 Windows 上的 kafka,我下载了 Debezium jar 文件,它们位于名为 debezium-connector-sqlserver 的文件夹中,如下所示:Kafka 文件夹,Debezium 文件夹
I'm trying to connect my SQL Server database to kafka on windows, i downloaded Debezium jar files, they are in a folder named debezium-connector-sqlserver, here's what it looks like : Kafka folder, Debezium folder
我还在connect-standalone.properties中添加了这一行plugin.path=C:\\current_kafka_2.12-2.0.0\\debezium-connector-sqlserver
,这是我把所有的我从 Debezium 下载的 jar 文件.
I also added this lineplugin.path=C:\\current_kafka_2.12-2.0.0\\debezium-connector-sqlserver
in connect-standalone.properties, it's where i put all the jar files i downloaded from Debezium.
我还创建了一个名为 connect-mssql.properties 的文件,并将其放入其中.
i also created a file named connect-mssql.properties, and i put this in it.
name=inventory-connector
connector.class=io.debezium.connector.sqlserver.SqlServerConnector
tasks.max=2
database.hostname=DESKTOP-LMJGRO0
database.port=1433
database.user=sa
database.password=password
database.dbname=Source
database.history.kafka.bootstrap.servers=localhost:9092
database.history.kafka.topic=test
table.whitelist=dbo.guinea_pig_source
现在当我尝试运行这个 .\bin\windows\connect-standalone .\config\connect-standalone.properties .\config\connect-mssql.properties
Now when i try to run this .\bin\windows\connect-standalone .\config\connect-standalone.properties .\config\connect-mssql.properties
我收到以下错误:
[2019-02-20 17:18:39,794] ERROR Stopping due to error (org.apache.kafka.connect.cli.ConnectStandalone)
java.lang.NoClassDefFoundError: io/debezium/util/IoUtil
at io.debezium.connector.sqlserver.Module.<clinit>(Module.java:19)
at io.debezium.connector.sqlserver.SqlServerConnector.version(SqlServerConnector.java:29)
at org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader.versionFor(DelegatingClassLoader.java:346)
at org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader.versionFor(DelegatingClassLoader.java:351)
at org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader.getPluginDesc(DelegatingClassLoader.java:328)
at org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader.scanPluginPath(DelegatingClassLoader.java:309)
at org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader.scanUrlsAndAddPlugins(DelegatingClassLoader.java:240)
at org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader.registerPlugin(DelegatingClassLoader.java:232)
at org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader.initPluginLoader(DelegatingClassLoader.java:201)
at org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader.initLoaders(DelegatingClassLoader.java:178)
at org.apache.kafka.connect.runtime.isolation.Plugins.<init>(Plugins.java:61)
at org.apache.kafka.connect.cli.ConnectStandalone.main(ConnectStandalone.java:77)
Caused by: java.lang.ClassNotFoundException: io.debezium.util.IoUtil
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.apache.kafka.connect.runtime.isolation.PluginClassLoader.loadClass(PluginClassLoader.java:104)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 12 more
推荐答案
将连接器 jar 文件和 kafka 库文件添加到类路径:
Add the connector jar files and kafka library files to the classpath :
在Linux中:export CLASSPATH=$CLASSPATH:/debezium-connector-sqlserver/*
In linux:export CLASSPATH=$CLASSPATH:/debezium-connector-sqlserver/*
导出 CLASSPATH=$CLASSPATH://kafka/libs/*
export CLASSPATH=$CLASSPATH://kafka/libs/*
这篇关于错误由于错误而停止 (org.apache.kafka.connect.cli.ConnectStandalone) java.lang.NoClassDefFoundError: io/debezium/util/IoUtil的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!