无法使用kafka-storm将拓扑提交给apache storm

Unable to submit topology to apache storm using kafka-storm

我在将我的拓扑提交到 Apache Storm(版本 0.10.0.2.4.0.0-169)时遇到错误,该工具使用来自 storm-kafka 的 Kafka spout。我正在使用来自 github 的最新版本的 storm-kafka,并且 运行ning kafka 0.9.0.2.4.

我可以 运行 通过使用 maven 下载的 storm-core 和 storm-kafka jar 文件,我可以 运行 这个拓扑的一个相当普通的版本,但是我需要对 spout class 进行更改,所以我有从源代码下载并自己构建它们,它在我的 ubuntu maven 开发环境中编译,但是在将拓扑提交给 storm 时出现错误。

"Found multiple defaults.yaml resources. You're probably building the Storm jars with your topology jar"

我假设这是因为我在我的 maven 依赖项中包含了 storm-core(我从源代码编译的本地版本(并添加到我的本地 maven 存储库),因为 storm-kafka 需要它并且从中提取的版本mvn 缺少 classes 是最新版本的 storm-kafka 所要求的)但是,如果我将 storm-core 设置为 pom.xml 中提供的,我在提交时会收到以下错误 -

"java.lang.class.NoClassDefFoundError: org/apache/storm/spout/scheme"

我认为这是因为它正在尝试使用缺少一些最新文件的某些包含的 storm-core 版本。

我似乎陷入了一个循环,要编译最新版本的 storm-kafka 我需要最新版本的 storm-core 需要从源代码自行编译,但我似乎不是能够将其部署到服务器而不会引起冲突。

我需要在风暴服务器上更新那个 jar 吗?我担心的是我最终需要更新它的依赖项等。

下面是我的pom.xml文件

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.automatedintelligence.datastorm</groupId>
<artifactId>DataStorm</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>DataStorm</name>
<url>https://github.com/markmcgookin/DataStorm</url>
<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
    <repository>
            <id>local-maven-repo</id>
            <url>file:///${project.basedir}/src/main/java/dependency/repo</url>
        </repository>
    <repository>
        <id>central</id>
        <url>http://central.maven.org/maven2/</url>
    </repository>
    <repository>
        <id>github-releases</id>
        <url>http://oss.sonatype.org/content/repositories/github-releases/</url>
    </repository>
    <repository>
        <id>mvnrepository</id>
        <url>http://mvnrepository.com/</url>
    </repository>
    <repository>
        <id>clojars.org</id>
        <url>http://clojars.org/repo</url>
    </repository>
    <repository>
        <id>twitter4j</id>
        <url>http://twitter4j.org/maven2</url>
    </repository>
</repositories>
<dependencies>
    <dependency>
        <groupId>com.googlecode.json-simple</groupId>
        <artifactId>json-simple</artifactId>
        <version>1.1</version>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>3.8.1</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-collections4</artifactId>
        <version>4.0</version>
    </dependency>
    <dependency>
        <groupId>org.apache.hbase</groupId>
        <artifactId>hbase-client</artifactId>
        <version>1.0.0</version>
        <exclusions>
            <exclusion>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-log4j12</artifactId>
            </exclusion>
            <exclusion> 
                <groupId>log4j</groupId>
                <artifactId>log4j</artifactId>
            </exclusion>
            <exclusion> 
                <groupId>org.slf4j</groupId>
                <artifactId>log4j-over-slf4j</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>                                                                                                                                       
        <groupId>org.apache.hadoop</groupId>                                                                                                           
        <artifactId>hadoop-common</artifactId>                                                                                                         
        <version>2.7.2</version>   
        <exclusions>
            <exclusion>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
            </exclusion>
            <exclusion> 
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-log4j12</artifactId>
            </exclusion>
            <exclusion> 
                <groupId>log4j</groupId>
                <artifactId>log4j</artifactId>
            </exclusion>
        </exclusions>                                                                                         
    </dependency> 
    <dependency>
        <groupId>storm</groupId>
        <artifactId>storm</artifactId>
        <version>0.9.0-rc2</version>
        <scope>provided</scope>
        <exclusions>
            <exclusion>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
            </exclusion>
            <exclusion> 
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-log4j12</artifactId>
            </exclusion>
            <exclusion> 
                <groupId>log4j</groupId>
                <artifactId>log4j</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.apache.kafka</groupId>
        <artifactId>kafka_2.11</artifactId>
        <version>0.9.0.0</version>
        <exclusions>
            <exclusion>
                <groupId>org.apache.zookeeper</groupId>
                <artifactId>zookeeper</artifactId>
            </exclusion>
            <exclusion> 
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-log4j12</artifactId>
            </exclusion>
            <exclusion> 
                <groupId>log4j</groupId>
                <artifactId>log4j</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.apache.storm</groupId>
        <artifactId>storm-kafka</artifactId>
        <version>2.0.0</version>
    </dependency>
    <dependency>
        <groupId>org.apache.storm</groupId>
        <artifactId>storm-core</artifactId>
        <version>2.0.0</version>
        <scope>provided</scope>
    </dependency>
</dependencies>
<build>
    <plugins>
        <!-- bind the maven-assembly-plugin to the package phase
        this will create a jar file without the Storm
        dependencies suitable for deployment to a cluster.-->
        <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <configuration>
                <descriptorRefs>
                    <descriptorRef>jar-with-dependencies</descriptorRef>
                </descriptorRefs>
                <archive>
                    <manifest>
                        <mainClass/>
                    </manifest>
                </archive>
            </configuration>
            <executions>
                <execution>
                    <id>make-assembly</id>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>com.theoryinpractise</groupId>
            <artifactId>clojure-maven-plugin</artifactId>
            <version>1.3.8</version>
            <extensions>true</extensions>
            <configuration>
                <sourceDirectories>
                    <sourceDirectory>src/clj</sourceDirectory>
                </sourceDirectories>
            </configuration>
            <executions>
                <execution>
                    <id>compile</id>
                    <phase>compile</phase>
                    <goals>
                        <goal>compile</goal>
                    </goals>
                </execution>
                <execution>
                    <id>test</id>
                    <phase>test</phase>
                    <goals>
                        <goal>test</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
                <excludes>
                    <exclude>sl4j:log4j:log4j:jar:</exclude>
                </excludes>
            </configuration>
        </plugin>
    </plugins>
</build>

我最终解决了这个问题,方法是使用来自 maven 存储库的预编译版本的 storm-kafka,并将过滤器螺栓添加到拓扑结构中,而不是在 spout 本身中进行过滤。

因此不再需要 storm-core 和 storm-kafka 本地编译的 jar 文件。

不是 "solution" 本身,但它是解决问题的一种方法。