nrepl

RAJKUMAR 2024-08-27T21:26:41.210789Z

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

RAJKUMAR 2024-08-27T21:27:01.203909Z

But I can connect using JDK

RAJKUMAR 2024-08-27T21:27:38.031139Z

I get this error when using JRE

RAJKUMAR 2024-08-27T21:28:06.982229Z

RAJKUMAR 2024-08-27T21:28:30.730579Z

in our remote environments, we use only JRE

RAJKUMAR 2024-08-27T21:28:39.806789Z

Any Idea how to resolve this error?

oyakushev 2024-08-27T21:29:19.181349Z

Hello! You are using CIDER, right?

RAJKUMAR 2024-08-27T21:42:06.228109Z

Nope. nrepl server and cursive client

oyakushev 2024-08-27T21:42:50.037699Z

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

oyakushev 2024-08-27T21:42:57.067419Z

How do you launch the server?

RAJKUMAR 2024-08-27T21:55:17.101659Z

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"]

oyakushev 2024-08-27T21:56:39.431349Z

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

RAJKUMAR 2024-08-27T21:57:43.188549Z

yeap

RAJKUMAR 2024-08-27T21:57:55.555489Z

nrepl is started using mount using some code like this

RAJKUMAR 2024-08-27T21:57:59.044219Z

(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)))

oyakushev 2024-08-27T21:58:26.446429Z

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

oyakushev 2024-08-27T21:59:10.238319Z

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

RAJKUMAR 2024-08-27T22:00:11.620689Z

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

👍 1
RAJKUMAR 2024-08-27T22:00:20.914369Z

Thanks @alexyakushev

oyakushev 2024-08-27T22:00:46.063549Z

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

vemv 2024-08-27T22:10:51.105569Z

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.

oyakushev 2024-08-27T22:12:26.223209Z

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 idealFirst 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.

RAJKUMAR 2024-08-27T22:13:03.929539Z

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

vemv 2024-08-27T22:22:32.316259Z

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.