0

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

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

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

我什至重申了融合,但仍然得到与这个谷歌小组答案中提到的错误相同的错误

4

2 回答 2

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
于 2018-08-02T14:32:30.610 回答
0

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

jar 的可能位置除了 confluent maven repo

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

于 2018-08-07T04:42:09.317 回答