nrepl 2024-08-27

Hi After upgrading JVM to 21, I couldn't connect to remote nrepl when using JRE

But I can connect using JDK

I get this error when using JRE

in our remote environments, we use only JRE

Any Idea how to resolve this error?

Hello! You are using CIDER, right?

Nope. nrepl server and cursive client

So, you don't add cider-nrepl middleware to the nREPL server?

How do you launch the server?

CMD ["sh", "-c", \
    "exec java \
    $JAVA_OPTS \
    -Dcom.sun.management.jmxremote \
    -Dcom.sun.management.jmxremote.port=$jmx_port \
    -Dcom.sun.management.jmxremote.local.only=false \
    -Dcom.sun.management.jmxremote.authenticate=false \
    -Dcom.sun.management.jmxremote.ssl=false \
    -Dcom.sun.management.jmxremote.rmi.port=$jmx_port \
    -Djava.rmi.server.hostname=$jmx_host \
    -cp app-${VERSION}.jar \
    app.cli config.edn"]

This doesn't show how nREPL server is started. You have to find it in the source code

nrepl is started using mount using some code like this

(ns myapp.nrepl
  (:require [mount.core :refer [defstate]]
            [nrepl.server :as nrepl]))

(defn handler []
  (require 'cider.nrepl)
  (ns-resolve 'cider.nrepl 'cider-nrepl-handler))

(defn start-server [{:keys [port bind]}]
    (nrepl/start-server
     :bind bind
     :port port
     :handler (handler)))

> (ns-resolve 'cider.nrepl 'cider-nrepl-handler)

Try upgrading cider-nrepl dependency in the project to 0.50.0. This should fix the issue.

sounds good. Let me try that and get back to you if I need any help

👍 1

@vemv FYI, here's another example why supporting JRE is important.

We've never intended to support cider-nrepl in production, in general the idea of adding an arbitrary set of dependencies, modifications, assumptions etc for a production app isn't exactly ideal supporting cider-less nrepl is a first-class goal and something that cider.el supports well.

We've never intended to support cider-nrepl in production, in general the idea of adding an arbitrary set of dependencies, modifications, assumptions etc for a production app isn't exactly ideal
First time I've hear about this and definitely counter to how I used cider-nrepl for years. Nothing prevented cider-nrepl to work in production before.

@vemv I agree. this is not for production but for lower environment

IDK I've witnessed many teams spontaneously coming to the conclusion that running the minimal-est of deps (nrepl) is the best choice for production. cider-nrepl has some side-effects such as alerting print methods. There also are a couple un-inlined dependencies by now.