将自定义Kafka Connect Converter安装到复制器连接器上

时间:2019-06-21 14:25:46

标签: apache-kafka apache-kafka-connect confluent

我正在寻找有关如何将自定义转换器安装到kafka-connect节点上的建议,以便可以通过复制器连接器使用它。

我做了什么:

  • 在confluentinc / schema-registry / avro-converter /中,我将“ AvroConverter”复制到“ AvroConverterLuke”,并写了一条小的日志消息,通知我我的自定义转换器已被提取
  • 重命名pom并建造它,因此它生产了一个罐子“ kafka-connect-avro-converter-luke-5.2.1.jar”
  • 基于Using a custom converter with Kafka Connect?这样的帖子,我将广口瓶放入了汇合的5.2.1 / share / java / kafka-connect-replicator

当我启动我的kafka连接复制器时,我看到罐子被拿起了,但是失败了

java.lang.LinkageError: loader constraint violation: when resolving field "schemaRegistry" the class loader (instance of org/apache/kafka/connect/runtime/isolation/PluginClassLoader) of the referring class, io/confluent/kafka/serializers/AbstractKafkaAvroSerDe, and the class loader (instance of sun/misc/Launcher$AppClassLoader) for the field's resolved type, io/confluent/kafka/schemaregistry/client/SchemaRegistryClient, have different Class objects for that type
    at io.confluent.connect.avro.AvroConverterLuke$Serializer.<init>(AvroConverterLuke.java:117)
    at io.confluent.connect.avro.AvroConverterLuke$Serializer.<init>(AvroConverterLuke.java:123)
    at io.confluent.connect.avro.AvroConverterLuke.configure(AvroConverterLuke.java:69)
    at org.apache.kafka.connect.runtime.isolation.Plugins.newConverter(Plugins.java:263)
    at org.apache.kafka.connect.runtime.Worker.startTask(Worker.java:412)
    at org.apache.kafka.connect.runtime.standalone.StandaloneHerder.createConnectorTasks(StandaloneHerder.java:307)
    at org.apache.kafka.connect.runtime.standalone.StandaloneHerder.updateConnectorTasks(StandaloneHerder.java:332)
    at org.apache.kafka.connect.runtime.standalone.StandaloneHerder.putConnectorConfig(StandaloneHerder.java:210)
    at org.apache.kafka.connect.cli.ConnectStandalone.main(ConnectStandalone.java:113)

很明显,我jar中包含的类与运行时Kafka Connect类存在某种冲突。

我的问题是,如何包装转换器,以便可以重用SchemaRegistryClient之类的类,但不会发生冲突?

0 个答案:

没有答案