Empty :repl profile causes FNFE for missing nREPL #893

Closed
jaceklaskowski opened this Issue Dec 27, 2012 · 6 comments

Comments

4 participants
Contributor

jaceklaskowski commented Dec 27, 2012

It's for the latest build from the sources.

Just discovered that the repl task can be configured with a :repl profile. With an empty one - :repl {} it causes the following exception.

$ lein2 repl
Exception in thread "main" java.io.FileNotFoundException: Could not locate clojure/tools/nrepl/server__init.class or clojure/tools/nrepl/server.clj on classpath: 
    at clojure.lang.RT.load(RT.java:432)
    at clojure.lang.RT.load(RT.java:400)
    at clojure.core$load$fn__4890.invoke(core.clj:5415)
    at clojure.core$load.doInvoke(core.clj:5414)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.core$load_one.invoke(core.clj:5227)
    at clojure.core$load_lib.doInvoke(core.clj:5264)
    at clojure.lang.RestFn.applyTo(RestFn.java:142)
    at clojure.core$apply.invoke(core.clj:603)
    at clojure.core$load_libs.doInvoke(core.clj:5298)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invoke(core.clj:603)
    at clojure.core$require.doInvoke(core.clj:5381)
    at clojure.lang.RestFn.invoke(RestFn.java:421)
    at user$eval1.invoke(NO_SOURCE_FILE:1)
    at clojure.lang.Compiler.eval(Compiler.java:6511)
    at clojure.lang.Compiler.eval(Compiler.java:6500)
    at clojure.lang.Compiler.eval(Compiler.java:6477)
    at clojure.core$eval.invoke(core.clj:2797)
    at clojure.main$eval_opt.invoke(main.clj:297)
    at clojure.main$initialize.invoke(main.clj:316)
    at clojure.main$null_opt.invoke(main.clj:349)
    at clojure.main$main.doInvoke(main.clj:427)
    at clojure.lang.RestFn.invoke(RestFn.java:421)
    at clojure.lang.Var.invoke(Var.java:419)
    at clojure.lang.AFn.applyToHelper(AFn.java:163)
    at clojure.lang.Var.applyTo(Var.java:532)
    at clojure.main.main(main.java:37)
Exception in thread "Thread-1" clojure.lang.ExceptionInfo: Subprocess failed {:exit-code 1}
    at clojure.core$ex_info.invoke(core.clj:4227)
    at leiningen.core.eval$eval5040$fn__5041.invoke(eval.clj:215)
    at clojure.lang.MultiFn.invoke(MultiFn.java:167)
    at leiningen.core.eval$eval_in_project.invoke(eval.clj:264)
    at leiningen.repl$start_server.doInvoke(repl.clj:71)
    at clojure.lang.RestFn.invoke(RestFn.java:470)
    at leiningen.repl$repl$fn__5177.invoke(repl.clj:172)
    at clojure.lang.AFn.applyToHelper(AFn.java:159)
    at clojure.lang.AFn.applyTo(AFn.java:151)
    at clojure.core$apply.invoke(core.clj:601)
    at clojure.core$with_bindings_STAR_.doInvoke(core.clj:1771)
    at clojure.lang.RestFn.invoke(RestFn.java:425)
    at clojure.lang.AFn.applyToHelper(AFn.java:163)
    at clojure.lang.RestFn.applyTo(RestFn.java:132)
    at clojure.core$apply.invoke(core.clj:605)
    at clojure.core$bound_fn_STAR_$fn__3984.doInvoke(core.clj:1793)
    at clojure.lang.RestFn.invoke(RestFn.java:397)
    at clojure.lang.AFn.run(AFn.java:24)
    at java.lang.Thread.run(Thread.java:722)
REPL server launch timed out.
Contributor

kenrestivo commented Dec 31, 2012

This is not fixed. I'm using current master e01a198 , and I get the NFE error.

I tried to hack around it by adding this to my profile:

 :repl {
        :dependencies [[org.clojure/tools.nrepl "0.2.0-RC1"
                                     :exclusions [org.clojure/clojure]]]
        }

But, then I get this incomprehensible, undebuggable error instead:

java.lang.NullPointerException
    at clojure.lang.Reflector.invokeInstanceMethod(Reflector.java:26)
    at leiningen.trampoline$win_batch_QMARK_.invoke(trampoline.clj:16)
    at leiningen.trampoline$trampoline_command_string.invoke(trampoline.clj:30)
    at leiningen.trampoline$write_trampoline.invoke(trampoline.clj:37)
    at leiningen.trampoline$trampoline.doInvoke(trampoline.clj:61)
    at clojure.lang.RestFn.invoke(RestFn.java:442)
    at clojure.lang.Var.invoke(Var.java:423)
    at clojure.lang.AFn.applyToHelper(AFn.java:167)
    at clojure.lang.Var.applyTo(Var.java:532)
    at clojure.core$apply.invoke(core.clj:603)
    at leiningen.core.main$resolve_task$fn__1561.doInvoke(main.clj:132)
    at clojure.lang.RestFn.applyTo(RestFn.java:139)
    at clojure.lang.AFunction$1.doInvoke(AFunction.java:29)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invoke(core.clj:603)
    at leiningen.core.main$apply_task.invoke(main.clj:167)
    at leiningen.core.main$_main$fn__1620.invoke(main.clj:236)
    at leiningen.core.main$_main.doInvoke(main.clj:221)
    at clojure.lang.RestFn.invoke(RestFn.java:436)
    at clojure.lang.Var.invoke(Var.java:423)
    at clojure.lang.AFn.applyToHelper(AFn.java:167)
    at clojure.lang.Var.applyTo(Var.java:532)
    at clojure.core$apply.invoke(core.clj:601)
    at clojure.main$main_opt.invoke(main.clj:324)
    at clojure.main$main.doInvoke(main.clj:427)
    at clojure.lang.RestFn.invoke(RestFn.java:482)
    at clojure.lang.Var.invoke(Var.java:431)
    at clojure.lang.AFn.applyToHelper(AFn.java:178)
    at clojure.lang.Var.applyTo(Var.java:532)
    at clojure.main.main(main.java:37)

This is when trying to run "lein trampoline repl" task.

Does trampoline actually work in leiningen or should I not be using it?

Contributor

kenrestivo commented Dec 31, 2012

Just to follow up, that error isn't so undebuggable, but it is very bizarre, because I'm not on windoze at all (linux wheezy). Everything works fine without trampoline. But trampoline breaks repl badly.

Contributor

kenrestivo commented Dec 31, 2012

Ah, nevermind, I found the cause of the problem, and hacked around it rather brutally:

``diff
--- a/src/leiningen/trampoline.clj
+++ b/src/leiningen/trampoline.clj
@@ -10,7 +10,7 @@
(def ^:dynamic trampoline? false)

(defn- trampoline-file []

  • (System/getenv "TRAMPOLINE_FILE"))
  • (or (System/getenv "TRAMPOLINE_FILE") ".trampoline"))

(defn- win-batch? [](.endsWith %28trampoline-file%29))

Contributor

kenrestivo commented Dec 31, 2012

sigh

--- a/src/leiningen/trampoline.clj
+++ b/src/leiningen/trampoline.clj
@@ -10,7 +10,7 @@
 (def ^:dynamic *trampoline?* false)

 (defn- trampoline-file []
-  (System/getenv "TRAMPOLINE_FILE"))
+  (or (System/getenv "TRAMPOLINE_FILE") ".trampoline"))

 (defn- win-batch? []
   (.endsWith (trampoline-file) ".bat"))

@kenrestivo kenrestivo pushed a commit to kenrestivo/leiningen that referenced this issue Dec 31, 2012

ken restivo Fix for fix for #893 65b5962
Contributor

kenrestivo commented Dec 31, 2012

And, FYI, with the above hack, AND with adding nrepl manually to :repl profile, I can get trampoline repl to work.

Collaborator

hyPiRion commented Dec 31, 2012

Strange, lein trampoline repl works fine for me from master, without the TRAMPOLINE_FILE set:

lein-master new test
cd test
# ensure you have an empty `repl`-profile either
# in `profiles.clj` or `project.clj`, or both
lein-master repl
# works fine, C-d out
lein-master trampoline repl
# works fine too

Sounds like there is an issue with the lein script here somehow, and it doesn't hook in the TRAMPOLINE_FILE environment variable correctly. Could you do DEBUG='y' lein-master trampoline repl and attach the trampoline command it spits out (if any)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment