如何将kafka-connect-spooldir插件添加到Apache Kafka

2hh7jdfx  于 2023-05-28  发布在  Apache
关注(0)|答案(1)|浏览(138)

我已经下载了kafka-connect-spooldir zip文件并将其解压缩。然后我在www.example.com文件中提供了它的lib文件夹的路径connect-distributed.properties,如下所示:

plugin.path=C:/Kafka/JDBC/kafka-connect-jdbc-10.4.0.jar,C:/kafka/jcustenborder-kafka-connect-spooldir-2.0.65/lib

然后在启动Kafka连接后,我得到了这个错误,它停止了。

INFO Loading plugin from: C:\kafka\jcustenborder-kafka-connect-spooldir-2.0.65\lib\kafka-connect-spooldir-2.0.65.jar (org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader:275)
[2023-05-26 10:15:06,936] ERROR Stopping due to error (org.apache.kafka.connect.cli.ConnectDistributed:89)
java.lang.NoClassDefFoundError: com/google/common/collect/Multimap
        at java.base/java.lang.Class.getDeclaredConstructors0(Native Method)
        at java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3473)
        at java.base/java.lang.Class.getConstructor0(Class.java:3678)
        at java.base/java.lang.Class.getDeclaredConstructor(Class.java:2854)
        at org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader.versionFor(DelegatingClassLoader.java:439)
        at org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader.getPluginDesc(DelegatingClassLoader.java:403)
        at org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader.scanPluginPath(DelegatingClassLoader.java:365)
        at org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader.scanUrlsAndAddPlugins(DelegatingClassLoader.java:296)
        at org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader.registerPlugin(DelegatingClassLoader.java:289)
        at org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader.initPluginLoader(DelegatingClassLoader.java:258)
        at org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader.initLoaders(DelegatingClassLoader.java:236)
        at org.apache.kafka.connect.runtime.isolation.Plugins.<init>(Plugins.java:65)
        at org.apache.kafka.connect.runtime.isolation.Plugins.<init>(Plugins.java:58)
        at org.apache.kafka.connect.cli.ConnectDistributed.startConnect(ConnectDistributed.java:96)
        at org.apache.kafka.connect.cli.ConnectDistributed.main(ConnectDistributed.java:83)
Caused by: java.lang.ClassNotFoundException: com.google.common.collect.Multimap
        at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:445)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
        at org.apache.kafka.connect.runtime.isolation.PluginClassLoader.loadClass(PluginClassLoader.java:136)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
        ... 15 more

这是通过将guava添加到Kafka的lib文件夹来解决的,我得到了这个错误

INFO Loading plugin from: C:\kafka\jcustenborder-kafka-connect-spooldir-2.0.65\lib\kafka-connect-spooldir-2.0.65.jar (org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader:275)
[2023-05-26 10:40:38,293] ERROR Stopping due to error (org.apache.kafka.connect.cli.ConnectDistributed:89)
java.lang.NoClassDefFoundError: com/github/jcustenborder/kafka/connect/utils/VersionUtil
        at com.github.jcustenborder.kafka.connect.spooldir.AbstractSpoolDirSourceConnector.version(AbstractSpoolDirSourceConnector.java:46)
        at org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader.versionFor(DelegatingClassLoader.java:433)
        at org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader.versionFor(DelegatingClassLoader.java:439)
        at org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader.getPluginDesc(DelegatingClassLoader.java:403)
        at org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader.scanPluginPath(DelegatingClassLoader.java:365)
        at org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader.scanUrlsAndAddPlugins(DelegatingClassLoader.java:296)
        at org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader.registerPlugin(DelegatingClassLoader.java:289)
        at org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader.initPluginLoader(DelegatingClassLoader.java:258)
        at org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader.initLoaders(DelegatingClassLoader.java:236)
        at org.apache.kafka.connect.runtime.isolation.Plugins.<init>(Plugins.java:65)
        at org.apache.kafka.connect.runtime.isolation.Plugins.<init>(Plugins.java:58)
        at org.apache.kafka.connect.cli.ConnectDistributed.startConnect(ConnectDistributed.java:96)
        at org.apache.kafka.connect.cli.ConnectDistributed.main(ConnectDistributed.java:83)
Caused by: java.lang.ClassNotFoundException: com.github.jcustenborder.kafka.connect.utils.VersionUtil
        at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:445)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
        at org.apache.kafka.connect.runtime.isolation.PluginClassLoader.loadClass(PluginClassLoader.java:136)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
        ... 13 more
piv4azn7

piv4azn71#

您需要检查这个repo,mvn clean package它,然后将它的JAR也复制到插件路径中
https://github.com/jcustenborder/connect-utils

相关问题