I am using Leiningen 2.5.3 on Java 1.7.0_79 OpenJDK 64-Bit Server VM.
I want to exclude storm-core jar using lein uberjar. Below is my project.clj
(defproject kafka2hdfs "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.5.1"]
[org.apache.storm/storm-kafka "0.9.5"]
[org.apache.storm/storm-hdfs "0.9.5"]
[org.apache.kafka/kafka_2.10 "0.8.2.1"]]
:plugins [[cider/cider-nrepl "0.10.0-SNAPSHOT"]]
:target-path "target/%s"
:dev-dependencies [[org.apache.storm/storm-core "0.9.5"]]
:main kafka2hdfs.core
:aot [kafka2hdfs.core])
Get error output from lein uberjar, how to fix this?
$ lein uberjar
Compiling kafka2hdfs.core
java.lang.ClassNotFoundException: backtype.storm.StormSubmitter, compiling:(core.clj:1:1)
Exception in thread "main" java.lang.ClassNotFoundException: backtype.storm.StormSubmitter, compiling:(core.clj:1:1)
at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:3463)
My core.clj file
(ns kafka2hdfs.core
(:import [backtype.storm StormSubmitter LocalCluster spout.SchemeAsMultiScheme]
[storm.kafka ZkHosts SpoutConfig StringScheme KafkaSpout]
[org.apache.storm.hdfs.bolt HdfsBolt]
[org.apache.storm.hdfs.bolt.format DefaultFileNameFormat DelimitedRecordFormat]
[org.apache.storm.hdfs.bolt.sync CountSyncPolicy]
[org.apache.storm.hdfs.bolt.rotation TimedRotationPolicy]
)
(:use [backtype.storm clojure config]) ;; for (topology ...)
(:gen-class))
(defn mk-topology []
;; ......
)
(topology
{"kafka-reader" (spout-spec kafka-reader :p 2)}
{"hdfs-writer" (bolt-spec {"kafka-reader" :shuffle} hdfs-writer :p 1)})
))
(defn submit-topology! [name]
(StormSubmitter/submitTopology
name
{TOPOLOGY-DEBUG true
TOPOLOGY-WORKERS 3}
(mk-topology)))
(defn -main
"a simple topology demo read from kafka ans write to hdfs"
[& args]
(submit-topology! "kafka2hdfs-topic-bigdata-obd"))
After a few hours, I find if I comment out :aot [kafka2hdfs.core] in project.clj, it works but output warning message:
$ lein do clean, uberjar
Warning: The Main-Class specified does not exist within the jar. It may not be executable as expected. A gen-class directive may be missing in the namespace which contains the main method.
I am new to lein and :aot, why?