KSQL Datagen-java.lang.ClassNotFoundException:MonitoringProducerInterceptor

时间:2018-08-01 11:46:02

标签: java apache-kafka confluent ksql

我正在探索融合的Kafka,并遵循confluent中的本快速入门指南。每当我尝试使用以下命令为Kafka主题创建一些示例数据时,我都会得到java.lang.ClassNotFoundException: io.confluent.monitoring.clients.interceptor.MonitoringProducerInterceptor

bin/ksql-datagen quickstart=pageviews format=delimited topic=pageviews maxInterval=100 \ propertiesFile=etc/ksql/datagen.properties

这是堆栈跟踪

Outputting 1000000 to pageviews
[2018-08-01 11:37:06,323] INFO AvroDataConfig values: 
    schemas.cache.config = 1
    enhanced.avro.schema.support = false
    connect.meta.data = true
 (io.confluent.connect.avro.AvroDataConfig:179)
Exception in thread "main" org.apache.kafka.common.KafkaException: Failed to construct kafka producer
    at org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:460)
    at org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:320)
    at io.confluent.ksql.datagen.DataGenProducer.populateTopic(DataGenProducer.java:76)
    at io.confluent.ksql.datagen.DataGen.main(DataGen.java:100)
Caused by: org.apache.kafka.common.KafkaException: io.confluent.monitoring.clients.interceptor.MonitoringProducerInterceptor ClassNotFoundException exception occurred
    at org.apache.kafka.common.config.AbstractConfig.getConfiguredInstances(AbstractConfig.java:357)
    at org.apache.kafka.common.config.AbstractConfig.getConfiguredInstances(AbstractConfig.java:332)
    at org.apache.kafka.common.config.AbstractConfig.getConfiguredInstances(AbstractConfig.java:319)
    at org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:381)
    ... 3 more
Caused by: java.lang.ClassNotFoundException: io.confluent.monitoring.clients.interceptor.MonitoringProducerInterceptor
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:348)
    at org.apache.kafka.common.utils.Utils.loadClass(Utils.java:333)
    at org.apache.kafka.common.utils.Utils.newInstance(Utils.java:322)
    at org.apache.kafka.common.config.AbstractConfig.getConfiguredInstances(AbstractConfig.java:355)
    ... 6 more

我已经按照快速入门指南中的每个步骤进行操作,这是我做错了什么?

我什至已经重述了合流,但是仍然遇到与该google group answer

中提到的错误相反的错误

2 个答案:

答案 0 :(得分:2)

我遇到了同样的问题,发现它仅适用于/etc/ksql/datagen.properties中的Confluent Enterprise:

# This properties file should ONLY be used when you run KSQL with Confluent Enterprise Platform.
interceptor.classes=io.confluent.monitoring.clients.interceptor.MonitoringProducerInterceptor

在删除propertiesFile后可以使用:

/bin/ksql-datagen quickstart=pageviews format=delimited topic=pageviews maxInterval=100

答案 1 :(得分:0)

  

在KSQL中放置monitoring-interceptors.jar(或由于此错误而导致融合服务失败)类路径 $ CONFLUENT_HOME / share / java / ksql / )    应该解决问题

除了汇合的Maven回购之外,罐子的可能位置

$ CONFLUENT_HOME / share / java / monitoring-interceptors / monitoring-interceptors-*。jar