[KAFKA-148] error: cannot be cast to class java.util.List Created: 24/Aug/20  Updated: 18/Jan/22  Resolved: 25/Aug/20

Status: Closed
Project: Kafka Connector
Component/s: Sink
Affects Version/s: 1.2.0
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Rajaramesh Yaramati Assignee: Ross Lawley
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates KAFKA-146 Validate all broken for invalid class... Closed
Related

 Description   

I get below error when I tried to use post-processing chain options I get below list error.

{"error_code":500,"message":"class java.lang.String cannot be cast to class java.util.List (java.lang.String and java.util.List are in module java.base of loader 'bootstrap')"}

My configuration:

curl -X POST -H "Accept:application/json" -H "Content-Type: application/json" localhost:9083/connectors/ --data '{ "name":"mongo-sink-accounts-projections-mongos-demo2", "config": { "topics":"oplog.oz_mongo.oz_next.accounts", "connector.class":"com.mongodb.kafka.connect.MongoSinkConnector", "tasks.max":"1", "key.converter":"org.apache.kafka.connect.json.JsonConverter", "key.converter.schemas.enable":"false", "value.converter":"org.apache.kafka.connect.json.JsonConverter", "value.converter.schemas.enable":"false", "connection.uri":"mongodb://x.x.x.x:27017", "database":"poc_oz_next", "collection":"poc_accounts_projection_demo2", "max.num.retries":"3", "retries.defer.timeout":"5000", "session.timeout.ms":"25000", "document.id.strategy":"com.mongodb.kafka.connect.sink.processor.id.strategy.UuidStrategy", "post.processor.chain":"com.mongodb.kafka.connect.sink.processor.DocumentIdAdder,com.mongodb.kafka.connect.sink.processor.BlocklistValueProjector", "value.projection.type":"blocklist", "value.projection.list":"trial, entitlements, settings"} }'

 

The document I am following: https://docs.mongodb.com/kafka-connector/master/kafka-sink-properties/#example-override-connector-sink-settings-on-topica

Thanks,

Rajaramesh



 Comments   
Comment by Ross Lawley [ 25/Aug/20 ]

Hi yaramati@adobe.com,

Many apologies, seems there is an error in the reporting of the cause of the invalid configuration, see KAFKA-146. Also the documentation has the incorrect case for the class.

Please update com.mongodb.kafka.connect.sink.processor.BlocklistValueProjector to com.mongodb.kafka.connect.sink.processor.BlockListValueProjector and it should work.

I'll get the documentation updated asap.

Ross

Generated at Thu Feb 08 09:05:41 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.