clojure-clutch/clutch

Could not initialize class clj_http.client__init

Closed this issue · 1 comments

Hi, I am getting a CompilerException when I'm trying to use clutch in my project.

Do you have any idea on what is happening ? I'm a bit lost.

Some informations :

$ lein version 
Leiningen 2.5.0 on Java 1.7.0_71 OpenJDK 64-Bit Server VM
$ lein clean ;; just to be sure
$ lein deps  
$ lein repl
;; nREPL server started on port 50281 on host 127.0.0.1 - nrepl://127.0.0.1:50281
;; REPL-y 0.3.5, nREPL 0.2.6
;; Clojure 1.6.0
;; OpenJDK 64-Bit Server VM 1.7.0_71-b14
;;  [...]

;; okay, so I'm in a REPL session, I try to require clutch
freedom-wars.server => (require '[com.ashafa.clutch :as clutch])
;; CompilerException java.lang.ExceptionInInitializerError, 
;; compiling:(com/ashafa/clutch/http_client.clj:1:1) 

;; `use` gives me a different exception
freedom-wars.server=> (use 'com.ashafa.clutch)
;; CompilerException java.lang.NoClassDefFoundError: 
;; Could not initialize class clj_http.client__init, compiling:(com/ashafa/clutch/http_client.clj:1:1) 

I cannot reproduce the problem from the clutch repo. If I clone the master branch, launch a REPL and require the namespace it works.

My project.clj is based on chestnut (My only change is that I have add clutch as a dependency):

(defproject freedom-wars "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"}

  :source-paths ["src/clj" "src/cljs"]

  :dependencies [[org.clojure/clojure "1.6.0"]
                 [org.clojure/clojurescript "0.0-2371" :scope "provided"]
                 [ring "1.3.1"]
                 [compojure "1.2.0"]
                 [enlive "1.1.5"]
                 [om "0.7.3"]
                 [figwheel "0.1.4-SNAPSHOT"]
                 [environ "1.0.0"]
                 [com.cemerick/piggieback "0.1.3"]
                 [weasel "0.4.0-SNAPSHOT"]
                 [com.ashafa/clutch "0.4.0"]
                 [leiningen "2.5.0"]]

  :plugins [[lein-cljsbuild "1.0.3"]
            [lein-environ "1.0.0"]]

  :min-lein-version "2.5.0"

  :uberjar-name "freedom-wars.jar"

  :cljsbuild {:builds {:app {:source-paths ["src/cljs"]
                             :compiler {:output-to     "resources/public/js/app.js"
                                        :output-dir    "resources/public/js/out"
                                        :source-map    "resources/public/js/out.js.map"
                                        :preamble      ["react/react.min.js"]
                                        :externs       ["react/externs/react.js"]
                                        :optimizations :none
                                        :pretty-print  true}}}}

  :profiles {:dev {:repl-options {:init-ns freedom-wars.server
                                  :nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]}

                   :plugins [[lein-figwheel "0.1.4-SNAPSHOT"]]

                   :figwheel {:http-server-root "public"
                              :port 3449
                              :css-dirs ["resources/public/css"]}

                   :env {:is-dev true}

                   :cljsbuild {:builds {:app {:source-paths ["env/dev/cljs"]}}}}

             :uberjar {:hooks [leiningen.cljsbuild]
                       :env {:production true}
                       :omit-source true
                       :aot :all
                       :cljsbuild {:builds {:app
                                            {:source-paths ["env/prod/cljs"]
                                             :compiler
                                             {:optimizations :advanced
                                              :pretty-print false}}}}}})

Hmm … It's maybe a problem from chestnut, seems similar to this issue.