这是我得到的错误
[2018-04-19 21:58:19,651] ERROR Failed to create job for /kafka/salesforce-source.properties (org.apache.kafka.connect.cli.ConnectStandalone:102)
[2018-04-19 21:58:19,651] ERROR Stopping after connector error (org.apache.kafka.connect.cli.ConnectStandalone:113)
java.util.concurrent.ExecutionException: org.apache.kafka.connect.runtime.rest.errors.BadRequestException: Connector configuration is invalid and contains the following 2 error(s):
Invalid value java.sql.SQLException: No suitable driver found for jdbc:sqlserver://<SERVER_IP>:1433;databaseName=<DATABASE>;user=<USER>;password=<PASSWORD> for configuration Couldn't open connection to jdbc:sqlserver://<SERVER_IP>:1433;databaseName=<DATABASE>;user=<USER>;password=<PASSWORD>
Invalid value java.sql.SQLException: No suitable driver found for jdbc:sqlserver://<SERVER_IP>:1433;databaseName=<DATABASE>;user=<USER>;password=<PASSWORD> for configuration Couldn't open connection to jdbc:sqlserver://<SERVER_IP>:1433;databaseName=<DATABASE>;user=<USER>;password=<PASSWORD>
You can also find the above list of errors at the endpoint `/{connectorType}/config/validate`
at org.apache.kafka.connect.util.ConvertingFutureCallback.result(ConvertingFutureCallback.java:79)
at org.apache.kafka.connect.util.ConvertingFutureCallback.get(ConvertingFutureCallback.java:66)
at org.apache.kafka.connect.cli.ConnectStandalone.main(ConnectStandalone.java:110)
Caused by: org.apache.kafka.connect.runtime.rest.errors.BadRequestException: Connector configuration is invalid and contains the following 2 error(s):
Invalid value java.sql.SQLException: No suitable driver found for jdbc:sqlserver://<SERVER_IP>:1433;databaseName=<DATABASE>;user=<USER>;password=<PASSWORD> for configuration Couldn't open connection to jdbc:sqlserver://<SERVER_IP>:1433;databaseName=<DATABASE>;user=<USER>;password=<PASSWORD>
Invalid value java.sql.SQLException: No suitable driver found for jdbc:sqlserver://<SERVER_IP>:1433;databaseName=<DATABASE>;user=<USER>;password=<PASSWORD> for configuration Couldn't open connection to jdbc:sqlserver://<SERVER_IP>:1433;databaseName=<DATABASE>;user=<USER>;password=<PASSWORD>
You can also find the above list of errors at the endpoint `/{connectorType}/config/validate`
at org.apache.kafka.connect.runtime.AbstractHerder.maybeAddConfigErrors(AbstractHerder.java:398)
at org.apache.kafka.connect.runtime.standalone.StandaloneHerder.putConnectorConfig(StandaloneHerder.java:164)
at org.apache.kafka.connect.cli.ConnectStandalone.main(ConnectStandalone.java:107)
架构配置文件
bootstrap.servers=localhost:9092
key.converter=org.apache.kafka.connect.json.JsonConverter
key.converter.schemas.enable=true
value.converter=org.apache.kafka.connect.json.JsonConverter
value.converter.schemas.enable=true
key.converter=io.confluent.connect.avro.AvroConverter
key.converter.schema.registry.url=http://localhost:8081
value.converter=io.confluent.connect.avro.AvroConverter
value.converter.schema.registry.url=http://localhost:8081
internal.key.converter=org.apache.kafka.connect.json.JsonConverter
internal.value.converter=org.apache.kafka.connect.json.JsonConverter
internal.key.converter.schemas.enable=false
internal.value.converter.schemas.enable=false
offset.storage.file.filename=/tmp/connect.offsets
rest.port=8084
plugin.path=/confluent-4.1.0/share/java/kafka-connect-jdbc/*,/confluent-4.1.0/share/java/kafka-connect-jdbc/kafka-connect-jdbc-4.1.0.jar,/confluent-4.1.0/share/java/kafka-connect-jdbc/mssql-jdbc-6.4.0.jre8.jar
连接配置
name=My-source
connector.class=JdbcSourceConnector
tasks.max=10
batch.max.rows=1000
connection.url=jdbc:sqlserver://<SERVER_IP>:1433;databaseName=<DATABASE>;user=<USER>;password=<PASSWORD>
query=SELECT * FROM dbo.ORDERS
mode=bulk
topic.prefix=MYTopic
poll.interval.ms=300000
/confluent-4.1.0/share/java/kafka-connect-jdbc
位于plugin.path
,kafka-connect-jdbc-4.1.0.jar
和mssql-jdbc-6.4.0.jre8.jar
都在那里。我在CLASSPATH
中也包含了这些路径,但它并没有产生影响
答案 0 :(得分:1)
将评论移至答案
share/java/kafka-connect-jdbc
文件夹。但我注意到他们也可以进入子目录plugin.path
解释中看到的其他问题,只需将其设置为Confluent安装的share/java
文件夹的绝对路径即可。 此外,connect-standalone
脚本应自动将所有kafka-connect-*/*
文件添加到类路径中,因此您可能根本不需要设置plugin.path
,但加载所有连接器的默认行为是如上所述share/java
。
如果您可以阅读bash,请参阅脚本逻辑
# Classpath addition for any Kafka Connect connectors
for library in $java_base_dir/kafka-connect-*; do
classpath_prefix="$CLASSPATH:"
if [ "x$CLASSPATH" = "x" ]; then
classpath_prefix=""
fi
CLASSPATH="$classpath_prefix$library/*"
done
答案 1 :(得分:0)
从 /kafka-connect-jdbc-4.0.0-package/share/java/kafka-connect-jdbc 更改插件路径后,我也遇到了同样的错误 /kafka-connect-jdbc-4.0.0-package/share ,它有效。
这适用于postgres和sql server连接。