taoensso / carmine

Redis client + message queue for Clojure
https://www.taoensso.com/carmine
Eclipse Public License 1.0
1.15k stars 130 forks source link

lein with-profile embed uberjar #188

Closed damesek closed 7 years ago

damesek commented 7 years ago

Hello,

I have problem with the Carmine uberjar compile. Maybe very easy the answer, but I didn't get any help from other forums. The lein ring server-headless 8080 run correctly. If I run this command lein with-profile embed uberjar, then I got this error message. Could you help me, what is the correct setup?

Thanks in advance, Szabolcs


(defproject fu "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :min-lein-version "2.0.0"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.8.0"]
                 [ring "1.3.2"]
                 [compojure "1.5.1"]
                 [ring/ring-defaults "0.2.1"]
                 [hiccup "1.0.5"]
                 [selmer "1.10.3"]
                 [com.cemerick/friend "0.2.0"]
                 [de.ubercode.clostache/clostache "1.4.0"]
                 [com.taoensso/carmine "2.15.0"]]
  :main fu.handler
  :plugins [[lein-ring "0.9.7"]]
  :ring {:handler fu.handler/app
         :auto-reload? true
         :auto-refresh? true}
  :aot [fu.handler]
  :uberjar-name "fu-example-default.jar"
  :profiles {
             :provided {:dependencies [[nginx-clojure "0.4.4"]]}
             :dev {:dependencies [[javax.servlet/servlet-api "2.5"]
                                  [ring/ring-mock "0.3.0"]]}
             :embed {:dependencies 
                       [[nginx-clojure/nginx-clojure-embed "0.4.4"]]
                     :aot [fu.handler]
                     :main  fu.handler
                     :uberjar-name "fu-example-embed.jar"
                     }
})  

​ ERROR message:

​lein with-profile embed uberjar WARNING: You're currently running as root; probably by accident. Press control-C to abort or Enter to continue as root. Set LEIN_ROOT to disable this warning. ​

Compiling fu.handler
Compiling fu.handler
nil
Exception in thread "main" java.lang.ExceptionInInitializerError, compiling:(/tmp/form-init8960082151990763547.clj:1:73)
    at clojure.lang.Compiler.load(Compiler.java:7391)
    at clojure.lang.Compiler.loadFile(Compiler.java:7317)
    at clojure.main$load_script.invokeStatic(main.clj:275)
    at clojure.main$init_opt.invokeStatic(main.clj:277)
    at clojure.main$init_opt.invoke(main.clj:277)
    at clojure.main$initialize.invokeStatic(main.clj:308)
    at clojure.main$null_opt.invokeStatic(main.clj:342)
    at clojure.main$null_opt.invoke(main.clj:339)
    at clojure.main$main.invokeStatic(main.clj:421)
    at clojure.main$main.doInvoke(main.clj:384)
    at clojure.lang.RestFn.invoke(RestFn.java:421)
    at clojure.lang.Var.invoke(Var.java:383)
    at clojure.lang.AFn.applyToHelper(AFn.java:156)
    at clojure.lang.Var.applyTo(Var.java:700)
    at clojure.main.main(main.java:37)
Caused by: java.lang.ExceptionInInitializerError
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:278)
    at clojure.lang.RT.classForName(RT.java:2168)
    at clojure.lang.RT.classForName(RT.java:2177)
    at clojure.lang.RT.loadClassForName(RT.java:2196)
    at clojure.lang.RT.load(RT.java:443)
    at clojure.lang.RT.load(RT.java:419)
    at clojure.core$load$fn__5677.invoke(core.clj:5893)
    at clojure.core$load.invokeStatic(core.clj:5892)
    at clojure.core$load.doInvoke(core.clj:5876)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.core$load_one.invokeStatic(core.clj:5697)
    at clojure.core$compile$fn__5682.invoke(core.clj:5903)
    at clojure.core$compile.invokeStatic(core.clj:5903)
    at clojure.core$compile.invoke(core.clj:5895)
    at user$eval20$fn__29.invoke(form-init8960082151990763547.clj:1)
    at user$eval20.invokeStatic(form-init8960082151990763547.clj:1)
    at user$eval20.invoke(form-init8960082151990763547.clj:1)
    at clojure.lang.Compiler.eval(Compiler.java:6927)
    at clojure.lang.Compiler.eval(Compiler.java:6917)
    at clojure.lang.Compiler.eval(Compiler.java:6917)
    at clojure.lang.Compiler.load(Compiler.java:7379)
    ... 14 more
Caused by: java.lang.ClassCastException: taoensso.carmine.protocol.Context cannot be cast to taoensso.carmine.protocol.Context
    at taoensso.carmine.commands$enqueue_request.invokeStatic(commands.clj:211)
    at taoensso.carmine.commands$enqueue_request.invoke(commands.clj:196)
    at taoensso.carmine$keys.invokeStatic(carmine.clj:128)
    at taoensso.carmine$keys.invoke(carmine.clj:128)
    at fu.handler$fn__8942$fn__8943$fn__8944.invoke(handler.clj:35)
    at taoensso.carmine.protocol$_with_replies.invokeStatic(protocol.clj:340)
    at taoensso.carmine.protocol$_with_replies.invoke(protocol.clj:328)
    at fu.handler$fn__8942$fn__8943.invoke(handler.clj:35)
    at fu.handler$fn__8942.invokeStatic(handler.clj:35)
    at fu.handler$fn__8942.invoke(handler.clj:35)
    at fu.handler__init.load(Unknown Source)
    at fu.handler__init.<clinit>(Unknown Source)
    ... 36 more

Compilation failed: Subprocess failed Uberjar aborting because jar failed: Compilation failed: Subprocess failed Error encountered performing task 'uberjar' with profile(s): 'embed' Uberjar aborting because jar failed: Compilation failed: Subprocess failed

damesek commented 7 years ago

Fu handler.clj 35 is the carmine connection to Redis (redis/get call)

damesek commented 7 years ago

Carmine can't read qualified keywords from Redis after compiled. That was the problem.