kafka JsonParseException: Unrecognized token 'xxx': was expecting ('true', 'false' or 'null') 异常解决

ERROR WorkerSinkTask{id=local-file-sink-0} Task is being killed and will not recover until manually restarted (org.apache.kafka.connect.runtime.WorkerTask:178)

 按照 http://kafka.apachecn.org/quickstart.html 中文文档做到 :

Step 7: 使用Kafka Connect来导入/导出数据

然后报了上面的异常

从kafka  JsonParseException: Unrecognized token 'xxx': was expecting ('true', 'false' or 'null') 可以知道是解析Json的时候异常

原因是我在:connect-file-sink.properties 里配置的 topic:liucf-topic3

之前在 Step 6: 设置多代理集群 中使用过connect-console-source.properties 通过控制台生产过消息,格式然后在topic:liucf-topic3中存在非json个的消息所以报上面的异常

 

解决办法是,清除这个topic里面的数据或者更换connect-file-sink.properties 里配置的topics=新的topic;

然后重新:bin/connect-standalone.sh config/connect-standalone.properties config/connect-file-source.properties config/connect-file-sink.properties

connect-standalone.properties:

注意这之前要删除connect.offsets 不然新建的ConnectStandalone不能通过test.txt 生产消息到新的topic 因为它记录还是上一次创建ConnectStandalone对应的topic。

删除后重新:

bin/connect-standalone.sh config/connect-standalone.properties config/connect-file-source.properties config/connect-file-sink.properties

就可以了

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值