解决java.lang.ClassNotFoundException: kafka.api.OffsetRequest问题

问题描述

在使用构建的AdvertisingTopology进行提交时,出现如下错误:

Image 18

问题解决

AdvertisingTopology项目中将kafka 2.0.0降低到版本0.8.2.1,并指定kafka-client版本。(主要应该是kafka2.0.0版本的问题)

<dependency>
                <groupId>org.apache.kafka</groupId>
                <artifactId>kafka_${scala.binary.version}</artifactId>
                <version>${kafka.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.apache.zookeeper</groupId>
                        <artifactId>zookeeper</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>log4j</groupId>
                        <artifactId>log4j</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <!-- https://mvnrepository.com/artifact/org.apache.kafka/kafka-clients -->
            <dependency>
                <groupId>org.apache.kafka</groupId>
                <artifactId>kafka-clients</artifactId>
                <version>${kafka.version}</version>
            </dependency>

资料参考

https://blog.csdn.net/yulio1234/article/details/77141192