storm 0.9.0-wip16: compile

Posted by Dillon Peng on February 16, 2017

从源代码0.9.0-wip16编译和运行storm

使用git clone 版本 0.9.0-wip16的storm

1
2
[abelard@abelard storm-source3]$ git clone https://github.com/nathanmarz/storm.git
[abelard@abelard storm-source3] cd storm

执行lein compile

  • 第一个错误
    1
    
     Exception in thread "main" java.lang.ClassNotFoundException: backtype.storm.LocalDRPC, compiling:(testing.clj:1)
    
  • 解答: 将storm.trident.testing ns
    1
    2
    3
    4
    5
    6
    7
    8
    
      (ns storm.trident.testing
      (:import [storm.trident.testing FeederBatchSpout FeederCommitterBatchSpout MemoryMapState MemoryMapState$Factory TuplifyArgs])
      (:import [backtype.storm LocalDRPC])
      (:import [backtype.storm.tuple Fields])
      (:import [backtype.storm.generated KillOptions])
      (:require [backtype.storm [testing :as t]])
      (:use [backtype.storm util])
      )
    
  • 改为:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    
     (ns storm.trident.testing
     (:require [backtype.storm.LocalDRPC])
     (:import [storm.trident.testing FeederBatchSpout FeederCommitterBatchSpout MemoryMapState MemoryMapState$Factory TuplifyArgs])
     (:import [backtype.storm LocalDRPC])
     (:import [backtype.storm.tuple Fields])
     (:import [backtype.storm.generated KillOptions])
     (:require [backtype.storm [testing :as t]])
     (:use [backtype.storm util])
     )
    

lein install

将storm打包后的jar文件安装到用户主目录(ex.,/home/abelard/)的.m2(mvn的 目录)下。

运行storm-starter的local mode

1
lein run -m storm.starter.WordCountTopology

运行storm-starter的distributed mode

1
2
3
cd storm-starter
lein clean;lein deps;lein compile;lein uberjar
storm jar target/storm-starter-0.0.1-SNAPSHOT-standalone.jar	storm.starter.ExclamationTopology exclamation-topology 

可能的错误

提示storm包重复,是因为project.clj文件写的不对,所以, uberjar将storm包,也打入到storm-starter-0.0.1-SNAPSHOT-standalone.jar中了。