298

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

David Smith
  • 38,044
  • 11
  • 44
  • 61
MattoxBeckman
  • 3,682
  • 2
  • 20
  • 16
  • 44
    `(/ 1 0)` - this hangs? Probably trying to evaluate infinity... ;-) – firefrorefiddle Mar 11 '13 at 09:41
  • 8
    Trying the `Attempt 2` in your local machine, it does work ok? That is starting `lein ritz-repl` and then connecting from emacs – guilespi Oct 23 '13 at 19:00
  • 4
    Yes, starting from my local machine worked fine. It's just remote connections that have trouble. – MattoxBeckman Oct 31 '13 at 22:07
  • 5
    If you follow these steps it should work: https://devcenter.heroku.com/articles/debugging-clojure – Avanz Mar 21 '14 at 23:10
  • 6
    Already answered bro. http://stackoverflow.com/questions/22908315/clojure-connection-issue-re-running-cider-jack-in It's not exactly what your looking for but it'll help – prestotron Jun 25 '14 at 17:15
  • As lame as it might sound, it seams that a restart for both machines is in order. Are you sure you do not have other instances of the same software lurking in the background and therefore making trouble? – Cninroh Oct 21 '14 at 10:22
  • 2
    Judging by the number of upvotes, it is probably a it more involved than a restart. – nha Nov 30 '14 at 16:12
  • you can try this link http://ianeslick.com/2013/05/17/clojure-debugging-13-emacs-nrepl-and-ritz/. it may help. – RishiKesh Pathak Dec 02 '14 at 10:41
  • 2
    You just hit a jackpot in SO with this questions, 1 from me as well. Although all of these technologies are new to me. – aspiring Dec 04 '14 at 08:12
  • 1
    In the unlikely event that this is a bug...stay calm and [report it] – AMDG Dec 08 '14 at 19:57
  • you can try [drawbackz](http://buzz.drawbackz.com/2014/12/how-can-i-make-nrepl-ritz-jack-in-work.html) – Parth Akbari Dec 23 '14 at 11:31

1 Answers1

1

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

Community
  • 1
  • 1
SyedAliNaqi
  • 244
  • 1
  • 12