Class 在 debezium db2 kafka connect 中找不到 DB2Driver

Class not found DB2Driver in debezium db2 kafka connect

我正在尝试使用 Kafka 连接(debezium 不可变 docker 图像)部署 debezium db2 连接器。 但是当我使用 kafka REST api 部署 db2 连接器时,它在 kafka 连接日志中给出了以下错误。

"2021-06-13 14:24:35,225 ERROR  ||  WorkerSourceTask{id=lifestyle-connector-0} Task threw an uncaught and unrecoverable exception. Task is being killed and will not recover until manually restarted   [org.apache.kafka.connect.runtime.WorkerTask]           
java.lang.NoClassDefFoundError: com/ibm/db2/jcc/DB2Driver
    at io.debezium.connector.db2.Db2Connection.<clinit>(Db2Connection.java:91)
    at io.debezium.connector.db2.Db2ConnectorTask.start(Db2ConnectorTask.java:74)
    at io.debezium.connector.common.BaseSourceTask.start(BaseSourceTask.java:130)
    at org.apache.kafka.connect.runtime.WorkerSourceTask.execute(WorkerSourceTask.java:232)
    at org.apache.kafka.connect.runtime.WorkerTask.doRun(WorkerTask.java:185)
    at org.apache.kafka.connect.runtime.WorkerTask.run(WorkerTask.java:234)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:834)                                   
Caused by: java.lang.ClassNotFoundException: com.ibm.db2.jcc.DB2Driver
    at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
    at org.apache.kafka.connect.runtime.isolation.PluginClassLoader.loadClass(PluginClassLoader.java:104)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
    ... 11 more"

我参考了以下教程 https://debezium.io/documentation/reference/tutorial.html#starting-kafka-connect

我已经使用 bin bash 登录到 kafka connect,并将 db2 dependancies jar 从我的本地文件夹复制到 lib 文件夹。 这解决了我的问题。