apache-kafka – java.lang.ClassNotFoundException:kafka.api.OffsetRequest

在尝试将Kafka集成到我们的Storm拓扑中时,我收到错误
java.lang.ClassNotFoundException kafka.api.OffsetRequest.

你正在运行哪些版本并且它正在运行?

我的pom.xml

  <dependency>
        <groupId>org.apache.storm</groupId>
        <artifactId>storm-core</artifactId>
        <version>0.9.2-incubating</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>org.apache.storm</groupId>
        <artifactId>storm-kafka</artifactId>
        <version>0.9.2-incubating</version>
    </dependency>

最佳答案 最后,我通过实现我自己的Kafka SPOUT(重用示例代码)来解决这个问题:

    <dependency>
        <groupId>org.apache.storm</groupId>
        <artifactId>storm-core</artifactId>
        <version>0.9.4</version>
    </dependency>
    <dependency>
        <groupId>org.apache.kafka</groupId>
        <artifactId>kafka_2.9.2</artifactId>
        <version>0.8.1.1</version>
        <scope>compile</scope>
        <exclusions>
            <exclusion>
                <artifactId>jmxri</artifactId>
                <groupId>com.sun.jmx</groupId>
            </exclusion>
            <exclusion>
                <artifactId>jms</artifactId>
                <groupId>javax.jms</groupId>
            </exclusion>
            <exclusion>
                <artifactId>jmxtools</artifactId>
                <groupId>com.sun.jdmk</groupId>
            </exclusion>
        </exclusions>
    </dependency>
点赞