Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot start nREPL within a lein project #88

Closed
youwithouto opened this issue Jan 28, 2018 · 9 comments
Closed

Cannot start nREPL within a lein project #88

youwithouto opened this issue Jan 28, 2018 · 9 comments

Comments

@youwithouto
Copy link

I have a brand new project created with: lein new app hello, but when I open the project with VS Code, it cannot connect to the REPL server.

The status is always "Starting nREPL...".

I've also tried to start the nREPL manually, but I experienced Issue 68.

Running lein repl from the project dir will start an REPL with the correct config given in the project.clj file.

It works fine with non-lein projects. The nREPL will connect smoothly when I start VS Code in a project that is not initialised with lein.

Specs:
Leiningen 2.8.1 on Java 9.0.1 Java HotSpot(TM) 64-Bit Server VM

@marcomorain
Copy link
Contributor

This PR should help debug what's going on - #92

@marcomorain
Copy link
Contributor

I've updated #92 to stop the Starting nREPL... message from persisting after the repl has failed to start.

@avli
Copy link
Owner

avli commented Feb 7, 2018

@youwithouto the PR mentioned above was merged and after you update to the latest version you'll be able to see nREPL errors in the nREPL output channel. Could you please try it out and share the results with us?

@youwithouto
Copy link
Author

I updated avli.clojure to v0.9.6, and created a new project with lein new app hello-world.

The error message below were shown in the output box, when I ran Clojure: start nREPL:

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by mranderson047.alembic.v0v3v3.dynapath.v0v2v5.dynapath.defaults$eval8228$fn__8229 to method java.net.URLClassLoader.addURL(java.net.URL)
WARNING: Please consider reporting this to the maintainers of mranderson047.alembic.v0v3v3.dynapath.v0v2v5.dynapath.defaults$eval8228$fn__8229
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Error loading refactor-nrepl.middleware: clojure.lang.ExceptionInfo: Alembic can not manipulate specified ClassLoader. {:classloader #object[jdk.internal.loader.ClassLoaders$AppClassLoader 0x484b61fc "jdk.internal.loader.ClassLoaders$AppClassLoader@484b61fc"], :reason :not-addable-with-dynapath}, compiling:(mranderson047/alembic/v0v3v3/alembic/still.clj:65:1)
Exception in thread "main" java.lang.RuntimeException: Unable to resolve var: refactor-nrepl.middleware/wrap-refactor in this context, compiling:(/private/var/folders/51/vs2fxvm12ljd9th180dmj63w0000gn/T/form-init12653312653371402023.clj:1:8836)
	at clojure.lang.Compiler.analyzeSeq(Compiler.java:6875)
	at clojure.lang.Compiler.analyze(Compiler.java:6669)
	at clojure.lang.Compiler.analyze(Compiler.java:6625)
	at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3834)
	at clojure.lang.Compiler.analyzeSeq(Compiler.java:6870)
	at clojure.lang.Compiler.analyze(Compiler.java:6669)
	at clojure.lang.Compiler.analyze(Compiler.java:6625)
	at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3834)
	at clojure.lang.Compiler.analyzeSeq(Compiler.java:6870)
	at clojure.lang.Compiler.analyze(Compiler.java:6669)
	at clojure.lang.Compiler.access$300(Compiler.java:38)
	at clojure.lang.Compiler$LetExpr$Parser.parse(Compiler.java:6269)
	at clojure.lang.Compiler.analyzeSeq(Compiler.java:6868)
	at clojure.lang.Compiler.analyze(Compiler.java:6669)
	at clojure.lang.Compiler.analyze(Compiler.java:6625)
	at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:6001)
	at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5380)
	at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3972)
	at clojure.lang.Compiler.analyzeSeq(Compiler.java:6866)
	at clojure.lang.Compiler.analyze(Compiler.java:6669)
	at clojure.lang.Compiler.eval(Compiler.java:6924)
	at clojure.lang.Compiler.eval(Compiler.java:6917)
	at clojure.lang.Compiler.load(Compiler.java:7379)
	at clojure.lang.Compiler.loadFile(Compiler.java:7317)
	at clojure.main$load_script.invokeStatic(main.clj:275)
	at clojure.main$init_opt.invokeStatic(main.clj:277)
	at clojure.main$init_opt.invoke(main.clj:277)
	at clojure.main$initialize.invokeStatic(main.clj:308)
	at clojure.main$null_opt.invokeStatic(main.clj:342)
	at clojure.main$null_opt.invoke(main.clj:339)
	at clojure.main$main.invokeStatic(main.clj:421)
	at clojure.main$main.doInvoke(main.clj:384)
	at clojure.lang.RestFn.invoke(RestFn.java:421)
	at clojure.lang.Var.invoke(Var.java:383)
	at clojure.lang.AFn.applyToHelper(AFn.java:156)
	at clojure.lang.Var.applyTo(Var.java:700)
	at clojure.main.main(main.java:37)
Caused by: java.lang.RuntimeException: Unable to resolve var: refactor-nrepl.middleware/wrap-refactor in this context
	at clojure.lang.Util.runtimeException(Util.java:221)
	at clojure.lang.Compiler$TheVarExpr$Parser.parse(Compiler.java:710)
	at clojure.lang.Compiler.analyzeSeq(Compiler.java:6868)
	... 36 more
Subprocess failed
nREPL exited with code 1

@avli
Copy link
Owner

avli commented Mar 10, 2018

@youwithouto it seems like the issue you've come upon is actually this one.

Could you please try to connect to nREPL manually as described here. The manual connection does not involve refactor-nrepl which causes the troubles.

Another thought that comes to my mind is we most likely don't use the refactor-nrepl facilities and probably it would be a good idea to temporary delete it from the embedded nREPL dependencies. Anyway, let me know about the results of manual connection.

@youwithouto
Copy link
Author

@avli Thanks for the instruction. The extension works well when I start an lein repl process and start the connection manually.

The only glitch is that the .clj file is always in the UNSAVED state, as shown in the image below. The state does not change when I press CMD+s or File -> Save.

unsaved state

@avli
Copy link
Owner

avli commented Mar 11, 2018

@youwithouto I've disabled refactor-nrepl until at least the issue with Java 9 will be resolved. Please update to the latest version and check out if everything works for you.

About this glitch – not sure if it has something to do with the extension but I'll check it out.

@youwithouto
Copy link
Author

@avli Everything works well now. Thanks!

Should I close this issue now or when you've figured out the reason of the glitch?

@avli
Copy link
Owner

avli commented Mar 11, 2018

Let's close it now for the glitch looks like a different issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants