Fork me on GitHub
#cider
<
2017-10-31
>
zane13:10:47

For some reason cider-connect is now auto-filling the wrong port for a server I started with lein repl :headless.

zane13:10:58

Has anyone seen that kind of behavior before?

reefersleep18:10:16

Is there a way to avoid the recent javax.xml.bind exception when starting up a cider repl? https://dev.clojure.org/jira/browse/CLJS-2377

reefersleep18:10:28

I see that there are some args that you can add in the repl command line, but I don’t know about Cider/Spacemacs

reefersleep18:10:10

To be accurate; when I start a Cider cljs repl, I get the following exception:

2. Unhandled clojure.lang.Compiler$CompilerException
   Error compiling cljs/util.cljc at (1:1)

             Compiler.java: 7391  clojure.lang.Compiler/load
                   RT.java:  372  clojure.lang.RT/loadResourceScript
                   RT.java:  363  clojure.lang.RT/loadResourceScript
                   RT.java:  453  clojure.lang.RT/load
... loads of stacktrace lines omitted ...
java.util.concurrent.ThreadPoolExecutor/runWorker
   ThreadPoolExecutor.java:  641  java.util.concurrent.ThreadPoolExecutor$Worker/run
               Thread.java:  844  java.lang.Thread/run

1. Caused by java.lang.ClassNotFoundException
   javax.xml.bind.DatatypeConverter

       URLClassLoader.java:  466  java.net.URLClassLoader/findClass
   DynamicClassLoader.java:   69  clojure.lang.DynamicClassLoader/findClass
          ClassLoader.java:  563  java.lang.ClassLoader/loadClass
... loads of stacktrace lines omitted ...

dpsutton18:10:11

i'm seeing

(defcustom cider-lein-global-options
  nil
  "Command global options used to execute Leiningen (e.g.: -o for offline)."
  :type 'string
  :group 'cider
  :safe #'stringp)

dpsutton18:10:32

you could set that to "--add-modules java.xml.bind"

dpsutton18:10:41

no idea if that will work but that's where i would start

reefersleep18:10:14

how do I do that?

reefersleep18:10:22

I’m not handy with elisp

reefersleep18:10:42

(setq cider-lein-global-options “--add-modules java.xml.bind”)

dpsutton18:10:50

that's one way but that will be "global"

dpsutton18:10:06

you can look into dir-locals, which will only apply under a particular directory structure

dpsutton18:10:18

but if this is a jdk thing it sounds like it should be global?

reefersleep18:10:24

maybe it’s OK that they’re global? 🙂

reefersleep18:10:29

I’ll just give it a go

dpsutton18:10:32

sounds good

reefersleep18:10:36

feedback in a min

dpsutton18:10:53

and you'll probably want that in your init so it is persisted

reefersleep18:10:18

apparently I don’t know how to add it properly to my .spacemacs

reefersleep18:10:25

tried both init and config

tanzoniteblack18:10:35

You could also set in the top level of the project that needs this a file called .dir-locals.el with the content

((nil . ((cider-lein-global-options . "--add-modules java.xml.bind"))))

tanzoniteblack18:10:50

^^^ this way, when checked in, it will work for anyone else using the project and emacs as well

reefersleep18:10:25

hmmm

error in process sentinel: Could not start nREPL server: ‘--add-modules’ is not a task. See ‘lein \
help’.

dpsutton18:10:41

oh. we're feeding lein the java options. i think there's a way to do this

reefersleep18:10:04

@tanzoniteblack I’ll try your approach

dpsutton18:10:05

:jvm-opts ["-Xmx1g" "-server"]

dpsutton18:10:12

i think we are fundamentally in the wrong area

dpsutton18:10:23

we need clj optionsin project, not elisp

tanzoniteblack18:10:23

^^^ Agreed, didn't realize this was a javac option

tanzoniteblack18:10:48

add to your jvm-opts vector "--add-modules=java.xml.bind" (or whatever the exact appropriate thing is) inside your project.clj

dpsutton18:10:48

although you could look to see how cider slides in cider-nrepl and try to emulate that

dpsutton18:10:15

so that this fix would happen for all of your projects until the fundamental fix is applied

dpsutton18:10:39

else you will have to edit every project.clj file you use

reefersleep18:10:56

I’m expecting the fix to go in soon, maybe foolishly. This is just for my hobby projects (until the same thing occurs at work, of course ; ) so I’ll live with the project.clj changes

reefersleep18:10:58

let me give it a go

reefersleep18:10:41

where do I put it in my project.clj?

reefersleep18:10:55

don’t have a :jvm-opts key there already

reefersleep18:10:14

great success! 😄 😄 😄 cider

reefersleep18:10:27

Thank you so much, @dpsutton @tanzoniteblack!