luminus-template
luminus-template copied to clipboard
NREPL errors in projects generated from this template
Hi there,
After a long absence from Clojure I thought I would take a look at Dmitri's book and I've hit a peculiar problem after generating a new project as per the instructions lein new luminus guestbook --template-version 3.91 -- +h2 +http-kit
. (The problem I'm about to describe also affects the current template version and does not seem to have anything to do with h2 or http-kit).
I start a REPL with lein repl
; this is using nrepl 0.8.3 and cider-nrepl 0.26.0 (the latest versions at time of writing). When I evaluate a simple form in Vim with fireplace it works fine. When I use Fireplace's Require!
command (which boils down to (require :reload-all)
I get errors from deep in nrepl.
user=> 2021-09-04 16:40:21,379 [nREPL-session-a02fb10d-98f1-4bf2-ac4f-51a6f8cde12c] ERROR guestbook.core - {:what :uncaught-exception, :exception #error {
:cause No implementation of method: :send of protocol: #'nrepl.transport/Transport found for class: nrepl.transport.FnTransport
:via
[{:type java.lang.IllegalArgumentException
:message No implementation of method: :send of protocol: #'nrepl.transport/Transport found for class: nrepl.transport.FnTransport
:at [clojure.core$_cache_protocol_fn invokeStatic core_deftype.clj 583]}]
:trace
[[clojure.core$_cache_protocol_fn invokeStatic core_deftype.clj 583]
[clojure.core$_cache_protocol_fn invoke core_deftype.clj 575]
[nrepl.transport$eval33772$fn__33773$G__33763__33780 invoke transport.clj 17]
[nrepl.middleware.print$send_streamed invokeStatic print.clj 136]
[nrepl.middleware.print$send_streamed invoke print.clj 122]
[nrepl.middleware.print$printing_transport$reify__15778 send print.clj 173]
[nrepl.middleware.caught$caught_transport$reify__15813 send caught.clj 58]
[nrepl.middleware.print$replying_PrintWriter$fn__15739 invoke print.clj 115]
[nrepl.middleware.print.proxy$java.io.Writer$ff19274a write nil -1]
[java.io.BufferedWriter flushBuffer BufferedWriter.java 120]
[java.io.BufferedWriter flush BufferedWriter.java 256]
[java.io.PrintWriter flush PrintWriter.java 396]
[nrepl.middleware.interruptible_eval$evaluate invokeStatic interruptible_eval.clj 136]
[nrepl.middleware.interruptible_eval$evaluate invoke interruptible_eval.clj 56]
[nrepl.middleware.interruptible_eval$interruptible_eval$fn__15887$fn__15891 invoke interruptible_eval.clj 152]
[clojure.lang.AFn run AFn.java 22]
[nrepl.middleware.session$session_exec$main_loop__15954$fn__15958 invoke session.clj 202]
[nrepl.middleware.session$session_exec$main_loop__15954 invoke session.clj 201]
[clojure.lang.AFn run AFn.java 22]
[java.lang.Thread run Thread.java 831]]}, :where Uncaught exception onnREPL-session-a02fb10d-98f1-4bf2-ac4f-51a6f8cde12c}
So why is the issue here and not in one of those other projects?
At first I assumed that my Vim setup had just rotted over the years. But a fresh install of emacs + spacemacs, jacking Cider into my repl process, had the same problems for the equivalent command.
I tried it on both my work (intel) macbook and my personal Linux machine - both exhibited the same error.
I then started trying it in different projects, using different templates. I have not yet found one that generates these errors apart from the luminus template.
Sorry if this is a misunderstanding on my part but I'm pretty much stumped at this point and googling the error message returns nothing relevant ...
I can reproduce the problem locally. It looks like the problem comes from the way nrepl is started in the guestbook.nrepl
namespace. If I comment out the reference to it from guestbook.core
then the problem goes away. I'll need to do a bit of investigating to see what the specific issue is.