Closed brunchboy closed 5 years ago
Is there any hope of removing this module dependency, or having the handler gracefully offer reduced functionality when it is unavailable?
I'll defer to @jeffvalk here, as our resident expert on the subject. I guess that'd be doable, but it will certainly break the Javadoc support in cider-nrepl. And probably whatever changes are needed should be done in Orchard, not cider-nrepl.
Right, I had half-thought about trying to investigate deeper as to whether that would be a more appropriate place to raise the issue, but got distracted by the fractal set of problems I’ve run into tonight, sorry! Hopefully it can be moved there if need be, or let me know if you would like me to close this issue and open another one there.
Some surprising additional information I have just learned: Even under JDK 11, as long as I am using Leiningen and cider-jack-in to run, this exact code works fine. It is only when I am running as an überjar that the jdk.javadoc
module is missing at runtime. Very strange.
And I take this all back, sorry for the false alarm. Apparently when I double-click Jar files on my Mac, it is running some semi-broken version of Oracle Java 10.0.2, and as long as I run via java -jar
things are working better, even in Java 11. I am going to chalk this up to problems with the jar launcher on my Mac and not cider-nrepl. If I find further evidence this is a problem, I will open a new issue, perhaps under orchard.
Am hitting this. Can confirm only happens when connecting to nrepl inside pre-built uberjar.
Running on:
Linux 4.14.152-127.182.amzn2.x86_64 #1 SMP Thu Nov 14 17:32:43 UTC 2019 x86_64 Linux
[nrepl "0.9.0"]
[cider/cider-nrepl "0.28.3"]
;; CIDER 1.4.0 (Kyiv), nREPL 0.9.0
;; Clojure 1.11.1, Java 11.0.11
Nrepl server starts with cider handler:
(nrepl.server/start-server
:port port
:handler cider.nrepl/cider-nrepl-handler)
``` ;; Connected to nREPL server - nrepl://localhost:9401 ;; CIDER 1.4.0 (Kyiv), nREPL 0.9.0 ;; Clojure 1.11.1, Java 11.0.11 ... skipped ... ;; ====================================================================== ERROR: Unhandled REPL handler exception processing message {:op init-debugger, :nrepl.middleware.print/stream? 1, :nrepl.middleware.print/print cider.nrepl.pprint/pprint, :nrepl.middleware.print/quota 1048576, :nrepl.middleware.print/buffer-size 4096, :nrepl.middleware.print/options {:right-margin 70}, :session 6dc05c21-c229-4de8-947e-accdb12c91f4, :id 6} Syntax error macroexpanding at (cider/nrepl/inlined_deps/orchard/v0v9v2/orchard/java/parser.clj:1:1). at clojure.lang.Compiler.load(Compiler.java:7665) at clojure.lang.RT.loadResourceScript(RT.java:381) at clojure.lang.RT.loadResourceScript(RT.java:372) at clojure.lang.RT.load(RT.java:459) at clojure.lang.RT.load(RT.java:424) at clojure.core$load$fn__6908.invoke(core.clj:6161) at clojure.core$load.invokeStatic(core.clj:6160) at clojure.core$load.doInvoke(core.clj:6144) at clojure.lang.RestFn.invoke(RestFn.java:408) at clojure.core$load_one.invokeStatic(core.clj:5933) at clojure.core$load_one.invoke(core.clj:5928) at clojure.core$load_lib$fn__6850.invoke(core.clj:5975) at clojure.core$load_lib.invokeStatic(core.clj:5974) at clojure.core$load_lib.doInvoke(core.clj:5953) at clojure.lang.RestFn.applyTo(RestFn.java:142) at clojure.core$apply.invokeStatic(core.clj:669) at clojure.core$load_libs.invokeStatic(core.clj:6016) at clojure.core$load_libs.doInvoke(core.clj:6000) at clojure.lang.RestFn.applyTo(RestFn.java:137) at clojure.core$apply.invokeStatic(core.clj:669) at clojure.core$require.invokeStatic(core.clj:6038) at clojure.core$require.doInvoke(core.clj:6038) at clojure.lang.RestFn.applyTo(RestFn.java:137) at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:3714) at clojure.lang.Compiler$BodyExpr.eval(Compiler.java:6151) at clojure.lang.Compiler$IfExpr.eval(Compiler.java:2741) at clojure.lang.Compiler$DefExpr.eval(Compiler.java:457) at clojure.lang.Compiler.eval(Compiler.java:7199) at clojure.lang.Compiler.load(Compiler.java:7653) at clojure.lang.RT.loadResourceScript(RT.java:381) at clojure.lang.RT.loadResourceScript(RT.java:372) at clojure.lang.RT.load(RT.java:459) at clojure.lang.RT.load(RT.java:424) at clojure.core$load$fn__6908.invoke(core.clj:6161) at clojure.core$load.invokeStatic(core.clj:6160) at clojure.core$load.doInvoke(core.clj:6144) at clojure.lang.RestFn.invoke(RestFn.java:408) at clojure.core$load_one.invokeStatic(core.clj:5933) at clojure.core$load_one.invoke(core.clj:5928) at clojure.core$load_lib$fn__6850.invoke(core.clj:5975) at clojure.core$load_lib.invokeStatic(core.clj:5974) at clojure.core$load_lib.doInvoke(core.clj:5953) at clojure.lang.RestFn.applyTo(RestFn.java:142) at clojure.core$apply.invokeStatic(core.clj:669) at clojure.core$load_libs.invokeStatic(core.clj:6016) at clojure.core$load_libs.doInvoke(core.clj:6000) at clojure.lang.RestFn.applyTo(RestFn.java:137) at clojure.core$apply.invokeStatic(core.clj:669) at clojure.core$require.invokeStatic(core.clj:6038) at clojure.core$require.doInvoke(core.clj:6038) at clojure.lang.RestFn.invoke(RestFn.java:619) at cider.nrepl.inlined_deps.orchard.v0v9v2.orchard.info$eval1396$loading__6789__auto____1397.invoke(info.clj:1) at cider.nrepl.inlined_deps.orchard.v0v9v2.orchard.info$eval1396.invokeStatic(info.clj:1) at cider.nrepl.inlined_deps.orchard.v0v9v2.orchard.info$eval1396.invoke(info.clj:1) at clojure.lang.Compiler.eval(Compiler.java:7194) at clojure.lang.Compiler.eval(Compiler.java:7183) at clojure.lang.Compiler.load(Compiler.java:7653) at clojure.lang.RT.loadResourceScript(RT.java:381) at clojure.lang.RT.loadResourceScript(RT.java:372) at clojure.lang.RT.load(RT.java:459) at clojure.lang.RT.load(RT.java:424) at clojure.core$load$fn__6908.invoke(core.clj:6161) at clojure.core$load.invokeStatic(core.clj:6160) at clojure.core$load.doInvoke(core.clj:6144) at clojure.lang.RestFn.invoke(RestFn.java:408) at clojure.core$load_one.invokeStatic(core.clj:5933) at clojure.core$load_one.invoke(core.clj:5928) at clojure.core$load_lib$fn__6850.invoke(core.clj:5975) at clojure.core$load_lib.invokeStatic(core.clj:5974) at clojure.core$load_lib.doInvoke(core.clj:5953) at clojure.lang.RestFn.applyTo(RestFn.java:142) at clojure.core$apply.invokeStatic(core.clj:669) at clojure.core$load_libs.invokeStatic(core.clj:6016) at clojure.core$load_libs.doInvoke(core.clj:6000) at clojure.lang.RestFn.applyTo(RestFn.java:137) at clojure.core$apply.invokeStatic(core.clj:669) at clojure.core$require.invokeStatic(core.clj:6038) at clojure.core$require.doInvoke(core.clj:6038) at clojure.lang.RestFn.invoke(RestFn.java:930) at cider.nrepl.middleware.stacktrace$eval1315$loading__6789__auto____1316.invoke(stacktrace.clj:1) at cider.nrepl.middleware.stacktrace$eval1315.invokeStatic(stacktrace.clj:1) at cider.nrepl.middleware.stacktrace$eval1315.invoke(stacktrace.clj:1) at clojure.lang.Compiler.eval(Compiler.java:7194) at clojure.lang.Compiler.eval(Compiler.java:7183) at clojure.lang.Compiler.load(Compiler.java:7653) at clojure.lang.RT.loadResourceScript(RT.java:381) at clojure.lang.RT.loadResourceScript(RT.java:372) at clojure.lang.RT.load(RT.java:459) at clojure.lang.RT.load(RT.java:424) at clojure.core$load$fn__6908.invoke(core.clj:6161) at clojure.core$load.invokeStatic(core.clj:6160) at clojure.core$load.doInvoke(core.clj:6144) at clojure.lang.RestFn.invoke(RestFn.java:408) at clojure.core$load_one.invokeStatic(core.clj:5933) at clojure.core$load_one.invoke(core.clj:5928) at clojure.core$load_lib$fn__6850.invoke(core.clj:5975) at clojure.core$load_lib.invokeStatic(core.clj:5974) at clojure.core$load_lib.doInvoke(core.clj:5953) at clojure.lang.RestFn.applyTo(RestFn.java:142) at clojure.core$apply.invokeStatic(core.clj:669) at clojure.core$load_libs.invokeStatic(core.clj:6016) at clojure.core$load_libs.doInvoke(core.clj:6000) at clojure.lang.RestFn.applyTo(RestFn.java:137) at clojure.core$apply.invokeStatic(core.clj:669) at clojure.core$require.invokeStatic(core.clj:6038) at clojure.core$require.doInvoke(core.clj:6038) at clojure.lang.RestFn.invoke(RestFn.java:1289) at cider.nrepl.middleware.debug$eval985$loading__6789__auto____986.invoke(debug.clj:1) at cider.nrepl.middleware.debug$eval985.invokeStatic(debug.clj:1) at cider.nrepl.middleware.debug$eval985.invoke(debug.clj:1) at clojure.lang.Compiler.eval(Compiler.java:7194) at clojure.lang.Compiler.eval(Compiler.java:7183) at clojure.lang.Compiler.load(Compiler.java:7653) at clojure.lang.RT.loadResourceScript(RT.java:381) at clojure.lang.RT.loadResourceScript(RT.java:372) at clojure.lang.RT.load(RT.java:459) at clojure.lang.RT.load(RT.java:424) at clojure.core$load$fn__6908.invoke(core.clj:6161) at clojure.core$load.invokeStatic(core.clj:6160) at clojure.core$load.doInvoke(core.clj:6144) at clojure.lang.RestFn.invoke(RestFn.java:408) at clojure.core$load_one.invokeStatic(core.clj:5933) at clojure.core$load_one.invoke(core.clj:5928) at clojure.core$load_lib$fn__6850.invoke(core.clj:5975) at clojure.core$load_lib.invokeStatic(core.clj:5974) at clojure.core$load_lib.doInvoke(core.clj:5953) at clojure.lang.RestFn.applyTo(RestFn.java:142) at clojure.core$apply.invokeStatic(core.clj:669) at clojure.core$load_libs.invokeStatic(core.clj:6016) at clojure.core$load_libs.doInvoke(core.clj:6000) at clojure.lang.RestFn.applyTo(RestFn.java:137) at clojure.core$apply.invokeStatic(core.clj:669) at clojure.core$require.invokeStatic(core.clj:6038) at clojure.core$require.doInvoke(core.clj:6038) at clojure.lang.RestFn.invoke(RestFn.java:408) at cider.nrepl$handler_future$fn__34283$fn__34284.invoke(nrepl.clj:53) at clojure.lang.AFn.applyToHelper(AFn.java:152) at clojure.lang.AFn.applyTo(AFn.java:144) at clojure.core$apply.invokeStatic(core.clj:667) at clojure.core$with_bindings_STAR_.invokeStatic(core.clj:1990) at clojure.core$with_bindings_STAR_.doInvoke(core.clj:1990) at clojure.lang.RestFn.invoke(RestFn.java:425) at cider.nrepl$handler_future$fn__34283.invoke(nrepl.clj:52) at clojure.lang.Delay.deref(Delay.java:42) at clojure.core$deref.invokeStatic(core.clj:2337) at clojure.core$deref.invoke(core.clj:2323) at cider.nrepl$wrap_debug$fn__34348.invoke(nrepl.clj:163) at nrepl.middleware$wrap_conj_descriptor$fn__33120.invoke(middleware.clj:16) at cider.nrepl$wrap_format$fn__34360.invoke(nrepl.clj:194) at nrepl.middleware$wrap_conj_descriptor$fn__33120.invoke(middleware.clj:16) at nrepl.middleware.load_file$wrap_load_file$fn__33922.invoke(load_file.clj:81) at nrepl.middleware$wrap_conj_descriptor$fn__33120.invoke(middleware.clj:16) at cider.nrepl$wrap_content_type$fn__34316.invoke(nrepl.clj:107) at nrepl.middleware$wrap_conj_descriptor$fn__33120.invoke(middleware.clj:16) at nrepl.middleware.completion$wrap_completion$fn__33900.invoke(completion.clj:58) at nrepl.middleware$wrap_conj_descriptor$fn__33120.invoke(middleware.clj:16) at cider.nrepl$wrap_spec$fn__34416.invoke(nrepl.clj:416) at nrepl.middleware$wrap_conj_descriptor$fn__33120.invoke(middleware.clj:16) at cider.nrepl$wrap_stacktrace$fn__34422.invoke(nrepl.clj:432) at nrepl.middleware$wrap_conj_descriptor$fn__33120.invoke(middleware.clj:16) at nrepl.middleware.lookup$wrap_lookup$fn__33948.invoke(lookup.clj:52) at nrepl.middleware$wrap_conj_descriptor$fn__33120.invoke(middleware.clj:16) at cider.nrepl$wrap_clojuredocs$fn__34466.invoke(nrepl.clj:529) at nrepl.middleware$wrap_conj_descriptor$fn__33120.invoke(middleware.clj:16) at cider.nrepl$wrap_profile$fn__34398.invoke(nrepl.clj:343) at nrepl.middleware$wrap_conj_descriptor$fn__33120.invoke(middleware.clj:16) at cider.nrepl$wrap_ns$fn__34386.invoke(nrepl.clj:300) at nrepl.middleware$wrap_conj_descriptor$fn__33120.invoke(middleware.clj:16) at cider.piggieback$wrap_cljs_repl$fn__34219.invoke(piggieback_impl.clj:365) at nrepl.middleware$wrap_conj_descriptor$fn__33120.invoke(middleware.clj:16) at cider.nrepl$wrap_out$fn__34392.invoke(nrepl.clj:334) at nrepl.middleware$wrap_conj_descriptor$fn__33120.invoke(middleware.clj:16) at cider.nrepl$wrap_inspect$fn__34374.invoke(nrepl.clj:227) at nrepl.middleware$wrap_conj_descriptor$fn__33120.invoke(middleware.clj:16) at nrepl.middleware.caught$wrap_caught$fn__33355.invoke(caught.clj:97) at nrepl.middleware$wrap_conj_descriptor$fn__33120.invoke(middleware.clj:16) at cider.nrepl$wrap_refresh$fn__34404.invoke(nrepl.clj:380) at nrepl.middleware$wrap_conj_descriptor$fn__33120.invoke(middleware.clj:16) at nrepl.middleware.print$wrap_print$fn__33326.invoke(print.clj:234) at nrepl.middleware$wrap_conj_descriptor$fn__33120.invoke(middleware.clj:16) at nrepl.middleware.session$add_stdin$fn__33530.invoke(session.clj:379) at nrepl.middleware$wrap_conj_descriptor$fn__33120.invoke(middleware.clj:16) at cider.nrepl$wrap_classpath$fn__34334.invoke(nrepl.clj:137) at nrepl.middleware$wrap_conj_descriptor$fn__33120.invoke(middleware.clj:16) at cider.nrepl$wrap_xref$fn__34460.invoke(nrepl.clj:514) at nrepl.middleware$wrap_conj_descriptor$fn__33120.invoke(middleware.clj:16) at cider.nrepl$wrap_undef$fn__34446.invoke(nrepl.clj:493) at nrepl.middleware$wrap_conj_descriptor$fn__33120.invoke(middleware.clj:16) at cider.nrepl$wrap_tracker$fn__34440.invoke(nrepl.clj:482) at nrepl.middleware$wrap_conj_descriptor$fn__33120.invoke(middleware.clj:16) at cider.nrepl$wrap_enlighten$fn__34354.invoke(nrepl.clj:190) at nrepl.middleware$wrap_conj_descriptor$fn__33120.invoke(middleware.clj:16) at cider.nrepl$wrap_apropos$fn__34328.invoke(nrepl.clj:129) at nrepl.middleware$wrap_conj_descriptor$fn__33120.invoke(middleware.clj:16) at cider.nrepl$wrap_resource$fn__34410.invoke(nrepl.clj:406) at nrepl.middleware$wrap_conj_descriptor$fn__33120.invoke(middleware.clj:16) at nrepl.middleware.session$session$fn__33517.invoke(session.clj:325) at nrepl.middleware$wrap_conj_descriptor$fn__33120.invoke(middleware.clj:16) at nrepl.server$default_handler$fn__34019.invoke(server.clj:141) at nrepl.server$handle_STAR_.invokeStatic(server.clj:24) at nrepl.server$handle_STAR_.invoke(server.clj:21) at nrepl.server$handle$fn__33987.invoke(server.clj:41) at clojure.core$binding_conveyor_fn$fn__5823.invoke(core.clj:2047) at clojure.lang.AFn.call(AFn.java:18) at java.base/java.util.concurrent.FutureTask.run(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.base/java.lang.Thread.run(Unknown Source) Caused by: java.lang.ClassNotFoundException: jdk.javadoc.doclet.Doclet at java.base/java.net.URLClassLoader.findClass(Unknown Source) at clojure.lang.DynamicClassLoader.findClass(DynamicClassLoader.java:69) at java.base/java.lang.ClassLoader.loadClass(Unknown Source) at clojure.lang.DynamicClassLoader.loadClass(DynamicClassLoader.java:77) at java.base/java.lang.ClassLoader.loadClass(Unknown Source) at java.base/java.lang.Class.forName0(Native Method) at java.base/java.lang.Class.forName(Unknown Source) at clojure.lang.RT.classForName(RT.java:2209) at clojure.lang.RT.classForNameNonLoading(RT.java:2222) at cider.nrepl.inlined_deps.orchard.v0v9v2.orchard.java.parser$eval1690$loading__6789__auto____1691.invoke(parser.clj:1) at cider.nrepl.inlined_deps.orchard.v0v9v2.orchard.java.parser$eval1690.invokeStatic(parser.clj:1) at cider.nrepl.inlined_deps.orchard.v0v9v2.orchard.java.parser$eval1690.invoke(parser.clj:1) at clojure.lang.Compiler.eval(Compiler.java:7194) at clojure.lang.Compiler.eval(Compiler.java:7183) at clojure.lang.Compiler.load(Compiler.java:7653) ```
Every attempt to execute anything in connected repl throws this without returning a result.
Maybe worth re-opening since this effectively makes handling with cider-nrepl
a non-starter. Sadly.
There are a few bits like this in the doc (you can grep Linux
in the cider
repo)
There's not much we can do about it. cider-nrepl generally is a development tool, so it requires a full dev JDK (which isn't the default case in Linux, and it is on macOS)
If you seek to run cider-nrepl on a production server you might want to either install a full JDK (which IMO doesn't affect anything - it's mostly pedantry from Linux distro maintainers), or use bare nrepl instead of cider-nrepl (which actually is a very frequent setup in prod apps - one just wants a minimal thing that will affect the least your dependency tree or other aspects)
Expected behavior
Setting up an embedded nREPL server using:
should work (with
nrepl-handler
defined as in the docs).Actual behavior
Upon connecting to the nREPL server from CIDER, the stack trace below is seen, and is repeated after every interaction. To avoid this, the application (which is shipped as an executable Jar) must be launched from the command line with an
-add-modules
option as follows:This is not necessary when running under JDK 10 or earlier. Since many of my users are non-programmers who are not familiar with the command line (and certainly not Java options), I would very much like to be able to continue allowing them to launch the program by double-clicking the Jar file, but I can’t see any way to do that under JDK 11 or later with cider-nrepl as it stands. Is there any hope of removing this module dependency, or having the handler gracefully offer reduced functionality when it is unavailable?
Here is the stacktrace:
Steps to reproduce the problem
Add an embedded nREPL server to a Clojure project using the method described at the top of the issue, compile that project to an überjar, then attempt to run it under JDK 11 and connect to the nREPL server using CIDER.
Environment & Version information
cider-nrepl version
E.g. 0.22.3
Java version
11.0.4, OpenJDK 64-Bit Server VM, Amazon.com Inc.
Operating system
macOS Mojave 10.14.6