我想把mongo的数据添加到Kafka的主题中。但我在发射后发现了这样的例外:
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.mongodb.kafka.connect.source.MongoSourceConfig
at com.mongodb.kafka.connect.MongoSourceConnector.config(MongoSourceConnector.java:91)
at org.apache.kafka.connect.runtime.AbstractHerder.validateConnectorConfig(AbstractHerder.java:366)
at org.apache.kafka.connect.runtime.AbstractHerder.lambda$validateConnectorConfig$1(AbstractHerder.java:326)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
... 1 more
在检查了可用的连接器列表之后,我看到了这个类
class":"com.mongodb.kafka.connect.MongoSourceConnector","type":"source","version":"1.5.0"},
我的错在哪里?谢谢!我的连接配置:
curl -X POST -H "Content-Type: application/json" --data '
{"name": "mongo-source-stockdata",
"config": {
"tasks.max":"1",
"connector.class":"com.mongodb.kafka.connect.MongoSourceConnector",
"key.converter":"org.apache.kafka.connect.json.JsonConverter",
"value.converter":"org.apache.kafka.connect.json.JsonConverter",
"connection.uri":"mongodb://localhost:27017",
"topic.prefix":"t_cb_",
"database":"testdb",
"collection":"contactbook_test"
}}' http://localhost:8083/connectors -w "\n"
暂无答案!
目前还没有任何答案,快来回答吧!