nathanmarz/storm — Issue #45: Clojure DSL cyclic load dependency
Author: nathanmarz
Created: 2011-11-15 04:09:46+00:00
State: open
Labels: Bug

From Patrick Houk:

Hi,
I think I stumbled upon a (minor) bug affecting the Clojure DSL.
Loading this:

(ns foo
(:require (backtype.storm [clojure :as storm])))

Throws the following (root) exception:
java.lang.Exception: Cyclic load dependency: [ /backtype/storm/
clojure ]->/backtype/storm/daemon/nimbus->/backtype/storm/testing->/
backtype/storm/LocalCluster->[ /backtype/storm/clojure ]
at clojure.core$check_cyclic_dependency.invoke(core.clj:4817)
at clojure.core$load.doInvoke(core.clj:4912)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:4729)
at clojure.core$load_lib.doInvoke(core.clj:4766)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invoke(core.clj:542)
at clojure.core$load_libs.doInvoke(core.clj:4804)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invoke(core.clj:544)
at clojure.core$use.doInvoke(core.clj:4892)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at backtype.storm.daemon.nimbus__init.load(Unknown Source)
at backtype.storm.daemon.nimbus__init.(Unknown Source)
... 90 more

An easy workaround is to import LocalCluster before requiring
storm.clojure (which the word_count.clj example in storm-starter
does).
So, this works:

(ns foo
(:import [backtype.storm LocalCluster])
(:require (backtype.storm [clojure :as storm])))
But this does not:
(ns foo
(:require (backtype.storm [clojure :as storm]))
(:import [backtype.storm LocalCluster]))

It's not a big deal, but I wanted to point it out since it may trip up
anyone who follows an "imports last" convention.