Kafka Connect:找不到合适的驱动程序

时间:2018-06-25 12:25:00

标签: postgresql apache-kafka apache-kafka-connect confluent

我正在尝试使用JDBC-sink连接器与Postgres Sink一起使用Kafka。

例外:

INFO Unable to connect to database on attempt 1/3. Will retry in 10000 ms. (io.confluent.connect.jdbc.util.CachedConnectionProvider:91)
java.sql.SQLException: No suitable driver found for jdbc:postgresql://localhost:5432/casb
at java.sql.DriverManager.getConnection(DriverManager.java:689)
    at java.sql.DriverManager.getConnection(DriverManager.java:247)
    at io.confluent.connect.jdbc.util.CachedConnectionProvider.newConnection(CachedConnectionProvider.java:85)
    at io.confluent.connect.jdbc.util.CachedConnectionProvider.getValidConnection(CachedConnectionProvider.java:68)
    at io.confluent.connect.jdbc.sink.JdbcDbWriter.write(JdbcDbWriter.java:56)
    at io.confluent.connect.jdbc.sink.JdbcSinkTask.put(JdbcSinkTask.java:69)
    at org.apache.kafka.connect.runtime.WorkerSinkTask.deliverMessages(WorkerSinkTask.java:495)
    at org.apache.kafka.connect.runtime.WorkerSinkTask.poll(WorkerSinkTask.java:288)
    at org.apache.kafka.connect.runtime.WorkerSinkTask.iteration(WorkerSinkTask.java:198)
    at org.apache.kafka.connect.runtime.WorkerSinkTask.execute(WorkerSinkTask.java:166)
    at org.apache.kafka.connect.runtime.WorkerTask.doRun(WorkerTask.java:170)
    at org.apache.kafka.connect.runtime.WorkerTask.run(WorkerTask.java:214)
    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)
    at java.lang.Thread.run(Thread.java:748)

Sink.properties:

name=test-sink
connector.class=io.confluent.connect.jdbc.JdbcSinkConnector
tasks.max=1
topics=fp_test
connection.url=jdbc:postgresql://localhost:5432/casb
connection.user=admin
connection.password=***
auto.create=true

我设置了plugin.path=/usr/share/java/kafka-connect-jdbc

/ usr / share / java / kafka-connect-jdbc 上,我有以下文件:

kafka-connect-jdbc-4.0.0.jarpostgresql-9.4-1206-jdbc41.jarsqlite-jdbc-3.8.11.2.jar和其他一些罐子,这些罐子和汇合的东西基本上一起包装了。

然后我下载了postgres-jdbc驱动程序jar postgresql-42.2.2.jar,将其复制到同一文件夹中,然后重试。还是一样。

请帮助我。

2 个答案:

答案 0 :(得分:4)

设置plugin.path=/usr/share/javaCLASSPATH=/usr/share/java/kafka-connect-jdbc/解决了该问题。

答案 1 :(得分:0)

我在kafka connect的分布式模式下遇到相同的错误。

**使用示例 https://github.com/debezium/debezium-examples/tree/master/tutorial#using-postgres链接 *

步骤:

{

} 1个信号源连接器 2接收器连接器的详细信息配置如下:

enter image description here