简体   繁体   中英

no String-argument constructor/factory method to deserialize from String value, when trying to deploy a debezium connector

I'm following along with a video tutorial for kafka connect and he wants me to deploy a debezium connector using the following curl command in cmd:

curl -i -X POST -H "Accept:application/json" -H "Content-Type:application/json" 
localhost:8083/connectors -d """{
    "name": "articles-connector", 
    "config": {
        "connector.class": "io.debezium.connector.mysql.MySqlConnector", 
        "tasks.max": "1", 
        "database.hostname": "mysql", 
        "database.port": "3305", 
        "database.user": "globalmantics", 
        "database.password": "password", 
        "database.server.id": "223344", 
        "database.server.name": "globalmantics", 
        "database.whitelist": "globalmantics", 
        "database.history.kafka.bootstrap.server": "kafka:9092", 
        "database.history.kafka.topic": "schema-changes" 
    } 
}"""

However when I run that command I get the following error:

HTTP/1.1 500 Internal Server Error
Date: Fri, 27 Jan 2023 16:46:12 GMT
Content-Type: application/json
Content-Length: 797
Server: Jetty(9.4.20.v20190813)

{"error_code":500,"message":"Cannot construct instance of `org.apache.kafka.connect.runtime.rest.entities.CreateConnectorRequest` (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('{name: articles-connector, config: {connector.class: io.debezium.connector.mysql.MySqlConnector, tasks.max: 1, database.hostname: mysql, database.port: 3305, database.user: globalmantics, database.password: password, database.server.id: 223344, database.server.name: globalmantics, database.whitelist: globalmantics, database.history.kafka.bootstrap.server: kafka:9092, database.history.kafka.topic: schema-changes } }')\n at [Source: (org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream); line: 1, column: 1]"}

Any ideas on what I'm doing wrong?

You need to remove the triple quotes. Use single quote around the JSON.

Or use a file.

curl -X POST \
  -H "Content-Type:application/json" \
  -d@connector.json \
  localhost:8083/connectors

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM