问题
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
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.
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
Now when i try to run this .\bin\windows\connect-standalone .\config\connect-standalone.properties .\config\connect-mssql.properties
I get the following error:
[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
回答1:
All plugin files must be in subdirectroy of "plugin.path=". For example if plugin path is:
plugin.path=F:/connect-plugins/
Create directory F:/connect-plugins/mssql-debezium with folowing files:
- debezium-connector-sqlserver-0.9.2.Final.jar
- debezium-core-0.9.2.Final.jar
- mssql-jdbc-6.4.0.jre8.jar
回答2:
Add the connector jar files and kafka library files to the classpath :
In linux: export CLASSPATH=$CLASSPATH:/debezium-connector-sqlserver/*
export CLASSPATH=$CLASSPATH://kafka/libs/*
回答3:
Try nesting your "debezium-connector-sqlserver" inside another folder e.g: "plugins" and update your connect-standalone.properties as plugin.path=C:\current_kafka_2.12-2.0.0\plugins
Thus your directory structure will be like, C:\current_kafka_2.12-2.0.0\plugins\debezium-connector-sqlserver and your jars will be located inside "debezium-connector-sqlserver"
来源:https://stackoverflow.com/questions/54791140/error-stopping-due-to-error-org-apache-kafka-connect-cli-connectstandalone-jav