ChatGPT解决这个技术问题 Extra ChatGPT

How can I make nrepl-ritz-jack-in work remotely over TRAMP / Emacs

What I want:

I have a clojure program on a remote site, let's call it mccarthy. What I want to do is connect to a nrepl-ritz from my laptop, preferably using nrepl-ritz-jack-in. The jack in works fine for a local program, but doesn't seem to connect to a remote program.

Attempt 1

C-x C-f on /mccarthy:code/program/project.clj

(require 'nrepl-ritz)

M-x nrepl-ritz-jack-in

Result

Emacs appears to hang. If I go to the *nrepl-server* buffer, I see this:

Exception in thread "main" java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.flatland.drip.Main.invoke(Main.java:117)
    at org.flatland.drip.Main.start(Main.java:88)
    at org.flatland.drip.Main.main(Main.java:64)
Caused by: java.lang.AssertionError: Assert failed: project
    at leiningen.ritz_nrepl$start_jpda_server.invoke(ritz_nrepl.clj:23)
    at leiningen.ritz_nrepl$ritz_nrepl.doInvoke(ritz_nrepl.clj:95)

(and tons of other lines, too...)

I am using drip on my laptop, but not on mccarthy, so clearly nrepl-ritz-jack-in is not detecting that it's a remote file. Regular old nrepl-jack-in will work as expected in this case, however.

Attempt 2

I also tried starting an nrepl-ritz using lein on mccarthy:

mattox@mccarthy$ lein ritz-nrepl
nREPL server started on port 42874

From my laptop I forward a port so local 42874 connects to 42874 on mccarthy:

ssh -L 42874:localhost:42874 -N mccarthy

Then, from my local Emacs:

(require 'nrepl-ritz)

M-x nrepl

Host: 127.0.0.1

Port: 42874

This gives me a connection:

; nREPL 0.1.7-preview
user> 

So to test it out, I run

M-x nrepl-ritz-threads

It gives me a nice table of threads.

M-x nrepl-ritz-break-on-exception

user> (/ 1 0)

Result

This hangs, but sometimes shows a hidden debugging buffer with some restarts available. If I tell it to pass the exception back to the program, it never gives control back to the REPL.

I've done plenty of searches but have not been able to get anything more specific than "make sure lein is on your path" (And I did do that, on both machines...).

(/ 1 0) - this hangs? Probably trying to evaluate infinity... ;-)
Trying the Attempt 2 in your local machine, it does work ok? That is starting lein ritz-repl and then connecting from emacs
Yes, starting from my local machine worked fine. It's just remote connections that have trouble.
If you follow these steps it should work: devcenter.heroku.com/articles/debugging-clojure
Already answered bro. stackoverflow.com/questions/22908315/… It's not exactly what your looking for but it'll help

C
Community

If the repl is still running from the previous cider-jack-in, you should either use the cidercommand to connect to the running instance, or stop the previous before starting a new one

From Here `Clojure - connection issue re-running cider-jack-in

Also see this https://devcenter.heroku.com/articles/debugging-clojure


关注公众号,不定期副业成功案例分享
Follow WeChat

Success story sharing

Want to stay one step ahead of the latest teleworks?

Subscribe Now