SAP / kafka-connect-sap

Kafka Connect SAP is a set of connectors, using the Apache Kafka Connect framework for reliably connecting Kafka with SAP systems
Apache License 2.0
119 stars 54 forks source link

com.sap.kafka.client.hana.HANAJdbcConnectionException: Cannot acquire a connection #77

Closed vinisbranco closed 2 years ago

vinisbranco commented 3 years ago

I have been trying to connect kafka with Hana using the connector, but i'm facing this problem:

com.sap.kafka.client.hana.HANAJdbcConnectionException: Cannot acquire a connection
    at com.sap.kafka.client.hana.HANAJdbcClient.getConnection(HANAJdbcClient.scala:71)
    at com.sap.kafka.connect.source.hana.HANASourceTask.getTables(HANASourceTask.scala:29)
    at com.sap.kafka.connect.source.GenericSourceTask.start(GenericSourceTask.scala:65)
    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:235)
    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: com.sap.kafka.client.hana.HANAJdbcBadStateException: Cannot acquire a connection
    at com.sap.kafka.client.hana.HANAJdbcClient.$anonfun$getConnection$1(HANAJdbcClient.scala:85)
    at com.sap.kafka.utils.ExecuteWithExceptions$.apply(ExecuteWithExceptions.scala:40)

my connect-standalone.properties


bootstrap.servers=localhost:9092

key.converter=org.apache.kafka.connect.json.JsonConverter
value.converter=org.apache.kafka.connect.json.JsonConverter

key.converter.schemas.enable=true
value.converter.schemas.enable=true

offset.storage.file.filename=/tmp/connect.offsets

offset.flush.interval.ms=10000
plugin.path=./plugins

my connect-hana-source.properties

name=test-topic-1-source
connector.class=com.sap.kafka.connect.source.hana.HANASourceConnector
tasks.max=1
topics=test_topic_1
connection.url=jdbc:sap://ip:port/
connection.user="usename"
connection.password="password"
test_topic_1.table.name=SCHEMA."TABLE"

openjdk version "11.0.10" kafka version: Scala 2.13 - kafka_2.13-2.6.0

elakito commented 3 years ago

The current logging is poor and it doesn't seem to provide much info and this needs to be improved. I think the most likely cause of the error is the wrong credential. Could you verify the connection parameters (URL and the user/password)?

elakito commented 3 years ago

I created this PR to log more helpful message when there is an error. https://github.com/SAP/kafka-connect-sap/pull/78

elakito commented 3 years ago

The PR is merged into master and the error cause should be shown in the log.