magomimmo / modern-cljs

A series of tutorials on ClojureScript
2.93k stars 289 forks source link

Shoreleave Middleware issue with Clojure 1.8.0 #384

Open sorlandoiii opened 7 years ago

sorlandoiii commented 7 years ago

Hi,

In the middle of tutorial 9 I encountered an error when trying to boot the application after requiring the shoreleave middleware. Below is the thrown error, but switching Clojure to 1.7.0 from 1.8.0 seemed to have solved the issue.

clojure.lang.ExceptionInfo: java.lang.RuntimeException: Too many arguments to throw, throw expects a single Throwable instance, compiling:(shoreleave/middleware/rpc.clj:46:20) data: {:file "/var/folders/zg/zj8dj9fn1l50xqzmt1n4ktt80000gn/T/boot.user714562230518841937.clj", :line 19} clojure.lang.Compiler$CompilerException: java.lang.RuntimeException: Too many arguments to throw, throw expects a single Throwable instance, compiling:(shoreleave/middleware/rpc.clj:46:20) java.lang.RuntimeException: Too many arguments to throw, throw expects a single Throwable instance ... clojure.core/load/fn core.clj: 5893 clojure.core/load/invokeStatic core.clj: 5892 clojure.core/load core.clj: 5876 ... clojure.core/load-one/invokeStatic core.clj: 5697 clojure.core/load-one core.clj: 5692 clojure.core/load-lib/fn core.clj: 5737 clojure.core/load-lib/invokeStatic core.clj: 5736 clojure.core/load-lib core.clj: 5717 ... clojure.core/apply/invokeStatic core.clj: 648 clojure.core/load-libs/invokeStatic core.clj: 5774 clojure.core/load-libs core.clj: 5758 ... clojure.core/apply/invokeStatic core.clj: 648 clojure.core/require/invokeStatic core.clj: 5796 clojure.core/require core.clj: 5796 ... modern-cljs.remotes/eval1100/loading--auto-- remotes.clj: 1 modern-cljs.remotes/eval1100/invokeStatic remotes.clj: 1 modern-cljs.remotes/eval1100 remotes.clj: 1 ... etc......

Tutorials have been very useful so far as well!

magomimmo commented 7 years ago

Hi,

did you try to checkout the se-tutorial-09 and see if it works before upgrade clj/cljs?

git checkout se-tutorial-09

magomimmo commented 7 years ago

I just tested the tutorial-09 as is starting from scratch as follows:

git clone https://github.com/magomimmo/modern-cljs.git
cd modern-cljs
git checkout se-tutorial-09
boot dev

and it works as expected without upgrading clj/cljs to 1.8. Are you sure you're using

[org.clojars.magomimmo/shoreleave-remote-ring "0.3.1"]
[org.clojars.magomimmo/shoreleave-remote "0.3.1"]

in the dependencies section of boot.boot?

magomimmo commented 7 years ago

Sorry, I just realised that you're were asking about clj 1.8.0 and not about 1.7.0.

sorlandoiii commented 7 years ago

Sorry for the delayed response, I have been away for the weekend.

I have the same results as you for when I clone the se-tutorial-09 branch (clj 1.7.0 works without issue). I also run into the same issue I had with my repo when I upgrade your se-tutorial-09 branch to clj 1.8.0 (same error as thrown above).

I had been continuously working through these tutorials and must have manually upgraded clj at some point. I don't see any of your tutorials referencing clj 1.8.0.

magomimmo commented 7 years ago

The series has been written before 1.8.0 was available. Try the following:

git clone https://github.com/magomimmo/shoreleave-remote-ring.git
cd shoreleave-remote-ring
lein install

Then edit the build.boot file by updating the clj/cljs deps and the shoreleave-remote-ring as well as follows:

(set-env!
 :source-paths #{"src/clj" "src/cljs"}
 :resource-paths #{"html"}

 :dependencies '[
                 [org.clojure/clojure "1.8.0"] 
                 [org.clojure/clojurescript "1.8.51"] 
                 [adzerk/boot-cljs "1.7.170-3"]
                 [pandeiro/boot-http "0.7.0"]
                 [adzerk/boot-reload "0.4.2"]
                 [adzerk/boot-cljs-repl "0.3.0"]       ;; add bREPL
                 [com.cemerick/piggieback "0.2.1"]     ;; needed by bREPL 
                 [weasel "0.7.0"]                      ;; needed by bREPL
                 [org.clojure/tools.nrepl "0.2.12"]    ;; needed by bREPL
                 [org.clojars.magomimmo/domina "2.0.0-SNAPSHOT"]
                 [hiccups "0.3.0"]
                 [compojure "1.4.0"]                   ;; for routing
                 [org.clojars.magomimmo/shoreleave-remote-ring "0.3.2"] ;; update to 0.3.2
                 [org.clojars.magomimmo/shoreleave-remote "0.3.1"]
                 [javax.servlet/servlet-api "2.5"]
                 ])

Then everything should work, at least for tutorial-09. I never tested all the remaining tutorial on clj/cljs 1.8.x

Hope it helps

sorlandoiii commented 7 years ago

Yeah everything starts up fine now, thanks for the help!

magomimmo commented 7 years ago

as I have some time I'll upgrade all the used libs....boot included. Probably I'll also review the testing tutorials to add few things about clojure specification