Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to create jdbc-sink connector; fails with ERROR Plugin class loader for connector: 'io.confluent.connect.jdbc.JdbcSinkConnector' #766

Closed
oviyan opened this issue Dec 17, 2019 · 1 comment

Comments

@oviyan
Copy link

oviyan commented Dec 17, 2019

I am trying to create jdbc sink connector on kafka-connect(not on confluent), and struggling with ERROR Plugin class loader for connector: 'io.confluent.connect.jdbc.JdbcSinkConnector'

I have set below path in CLASSPATH, and placed all jdbc connect related JARs.
C:\Oviyan\Software\kafka_2.12-2.3.1\libs
C:\Oviyan\Software\confluentinc-kafka-connect-jdbc-5.3.1\lib

Config properties:

connect-standalone.properties:

bootstrap.servers=localhost:9092
key.converter=org.apache.kafka.connect.storage.StringConverter
value.converter=org.apache.kafka.connect.storage.StringConverter
key.converter.schemas.enable=true
value.converter.schemas.enable=true
offset.storage.file.filename=/tmp/connect.offsets
offset.flush.interval.ms=10000
plugin.path=C:<user-name>\Software\kafka_2.12-2.3.1\libs\kafka-connect-jdbc
rest.port=8086
rest.host.name=localhost

Jdbc-connect-config.properties:

name=test-sink-jdbc-autoincrement
connector.class=io.confluent.connect.jdbc.JdbcSinkConnector
tasks.max=1
topics=test-topic
connection.url=jdbc:postgres://localhost:5432/kafka-test1
connection.user=***
connection.password=*****
auto.create=true

Error Log:

ERROR Plugin class loader for connector: 'io.confluent.connect.jdbc.JdbcSinkConnector' was not found. Returning: org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader@3a1dd365 (org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader)
[2019-12-17 11:34:43,590] ERROR WorkerSinkTask{id=test-sink-jdbc-autoincrement-0} Task threw an uncaught and unrecoverable exception. Task is being killed and will not recover until manually restarted. (org.apache.kafka.connect.runtime.WorkerSinkTask)
org.apache.kafka.connect.errors.ConnectException: java.sql.SQLException: No suitable driver found for jdbc:postgres://localhost:5432/kafka-test1
at io.confluent.connect.jdbc.util.CachedConnectionProvider.getConnection(CachedConnectionProvider.java:69)
at io.confluent.connect.jdbc.sink.JdbcDbWriter.write(JdbcDbWriter.java:56)
at io.confluent.connect.jdbc.sink.JdbcSinkTask.put(JdbcSinkTask.java:74)
at org.apache.kafka.connect.runtime.WorkerSinkTask.deliverMessages(WorkerSinkTask.java:539)
at org.apache.kafka.connect.runtime.WorkerSinkTask.poll(WorkerSinkTask.java:322)
at org.apache.kafka.connect.runtime.WorkerSinkTask.iteration(WorkerSinkTask.java:224)
at org.apache.kafka.connect.runtime.WorkerSinkTask.execute(WorkerSinkTask.java:192)
at org.apache.kafka.connect.runtime.WorkerTask.doRun(WorkerTask.java:177)
at org.apache.kafka.connect.runtime.WorkerTask.run(WorkerTask.java:227)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.sql.SQLException: No suitable driver found for jdbc:postgres://localhost:5432/kafka-test1

Appreciate any help!

@gharris1727
Copy link
Contributor

@oviyan These are two unrelated errors, but I can explain a bit behind each one to help you resolve them.

  1. Plugin class loader for connector... indicates that the connector is getting loaded in the same classloader as the the connect worker, probably because the connector is in the kafka lib directory. I would suggest moving the connector out of that directory to avoid this exception, and have it loaded only through the plugin.path instead.

  2. No suitable driver found for... indicates that the classloader that loaded the connector did not have the driver for the postgres subprotocol available. I see in the Postgresql database dialect that it triggers on the subprotocol of postgresql, not postgres. I would try changing your URL to this subprotocol, to see if the driver provider mechanism needs a different subprotocol to trigger.

I hope these answers get you off the ground with your connector! If you have any more follow up questions, please re-open this issue and we can discuss it further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants