2016-04-04 196 views
0

我在將我的拓撲提交給Apache風暴(版本0.10.0.2.4.0.0-169)時發現錯誤,該風暴將卡夫卡噴口從風暴卡夫卡中提取出來。我正在使用github的最新版本的storm-kafka,並運行kafka 0.9.0.2.4。無法使用kafka風暴將拓撲提交給apache風暴

我可以使用Maven下載的jar文件進行storm-core和storm-kafka的運行,但我需要對噴口類進行更改,所以我不得不從源代碼下載並自己構建它們,它在我的maven的ubuntu dev環境下編譯,但是我在將拓撲提交給storm時遇到錯誤。

「找到多個defaults.yaml資源。你可能建設有拓撲罐子風暴罐子」

我想這是因爲我,包括我的Maven依賴風暴核心(本地版本我編譯從源代碼(並添加到我的本地Maven存儲庫),因爲它需要在風暴卡夫卡和從mvn拉的版本缺少最新版本的風暴卡夫卡所需的類),但是,如果我設置風暴核心提供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> 

回答

0

我最終使用解決此問題,工作預編譯版本的maven repo中的storm-kafka,並在過濾器螺栓中添加拓撲結構,而不是在噴口本身進行過濾。

因此不需要使用storm-core和storm-kafka本地編譯的jar文件。

不是「解決方案」,而是解決問題的方法。