Skip to content

Instantly share code, notes, and snippets.

@kohyama
Last active September 18, 2015 09:28
Show Gist options
  • Save kohyama/1fd05f5ece19a0e50b88 to your computer and use it in GitHub Desktop.
Save kohyama/1fd05f5ece19a0e50b88 to your computer and use it in GitHub Desktop.
I can't execute a standalone jar using lighttable.nrepl.handler/lighttable-ops.
(defproject nltry "0.1"
:dependencies [
[org.clojure/clojure "1.7.0"]
[org.clojure/tools.nrepl "0.2.11"]
[lein-light-nrepl "0.1.3"]
]
:aot :all
:main nltry.core
:repl-options {:nrepl-middleware [lighttable.nrepl.handler/lighttable-ops]}
)
(ns nltry.core
(:gen-class)
(:require [clojure.tools.nrepl.server :refer (start-server default-handler)]
[lighttable.nrepl.handler :refer (lighttable-ops)]))
(defn foo [a b] (+ a b))
(defn -main [& args]
(start-server :port 3000 :handler (default-handler #'lighttable-ops)))
@kohyama
Copy link
Author

kohyama commented Sep 18, 2015

I can't execute a standalone jar using lighttable.nrepl.handler/lighttable-ops.

Environment

% uname -mrv
13.4.0 Darwin Kernel Version 13.4.0: Wed Mar 18 16:20:14 PDT 2015; root:xnu-2422.115.14~1/RELEASE_X86_64 x86_64
% lein --version
Leiningen 2.5.2 on Java 1.8.0_40 Java HotSpot(TM) 64-Bit Server VM

'lein repl' works

% lein repl :headless :port 3000
nREPL server started on port 3000 on host 127.0.0.1 - nrepl://127.0.0.1:3000

I can let LightTable connect to this nREPL server.
This nREPL server is not one that was launched by my code but by leiningen.

'lein run' works

% lein run
Compiling nltry.core

I can let LightTable connect to this nREPL server.
This nREPL server is one that was launched by my code (start-server ...).

ss 2015-09-18 13 24 23

A standalone jar

A standalone jar doesn't work. It can not be executed.

% lein uberjar
Compiling nltry.core
Created xxx/nltry/target/nltry-0.1.jar
Created xxx/nltry/target/nltry-0.1-standalone.jar
% java -jar target/nltry-0.1-standalone.jar
Exception in thread "main" java.lang.ExceptionInInitializerError
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:348)
    at clojure.lang.RT.classForName(RT.java:2154)
    at clojure.lang.RT.classForName(RT.java:2163)
    at clojure.lang.RT.loadClassForName(RT.java:2182)
    at clojure.lang.RT.load(RT.java:436)
    at clojure.lang.RT.load(RT.java:412)
    at clojure.core$load$fn__5448.invoke(core.clj:5866)
    at clojure.core$load.doInvoke(core.clj:5865)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.core$load_one.invoke(core.clj:5671)
    at clojure.core$load_lib$fn__5397.invoke(core.clj:5711)
    at clojure.core$load_lib.doInvoke(core.clj:5710)
    at clojure.lang.RestFn.applyTo(RestFn.java:142)
    at clojure.core$apply.invoke(core.clj:632)
    at clojure.core$load_libs.doInvoke(core.clj:5749)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invoke(core.clj:632)
    at clojure.core$require.doInvoke(core.clj:5832)
    at clojure.lang.RestFn.invoke(RestFn.java:1289)
    at lighttable.nrepl.handler$loading__5340__auto____777.invoke(handler.clj:1)
    at lighttable.nrepl.handler__init.load(Unknown Source)
    at lighttable.nrepl.handler__init.<clinit>(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:348)
    at clojure.lang.RT.classForName(RT.java:2154)
    at clojure.lang.RT.classForName(RT.java:2163)
    at clojure.lang.RT.loadClassForName(RT.java:2182)
    at clojure.lang.RT.load(RT.java:436)
    at clojure.lang.RT.load(RT.java:412)
    at clojure.core$load$fn__5448.invoke(core.clj:5866)
    at clojure.core$load.doInvoke(core.clj:5865)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.core$load_one.invoke(core.clj:5671)
    at clojure.core$load_lib$fn__5397.invoke(core.clj:5711)
    at clojure.core$load_lib.doInvoke(core.clj:5710)
    at clojure.lang.RestFn.applyTo(RestFn.java:142)
    at clojure.core$apply.invoke(core.clj:632)
    at clojure.core$load_libs.doInvoke(core.clj:5749)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invoke(core.clj:632)
    at clojure.core$require.doInvoke(core.clj:5832)
    at clojure.lang.RestFn.invoke(RestFn.java:421)
    at nltry.core$loading__5340__auto____31.invoke(core.clj:2)
    at nltry.core__init.load(Unknown Source)
    at nltry.core__init.<clinit>(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:348)
    at clojure.lang.RT.classForName(RT.java:2154)
    at clojure.lang.RT.classForName(RT.java:2163)
    at clojure.lang.RT.loadClassForName(RT.java:2182)
    at clojure.lang.RT.load(RT.java:436)
    at clojure.lang.RT.load(RT.java:412)
    at clojure.core$load$fn__5448.invoke(core.clj:5866)
    at clojure.core$load.doInvoke(core.clj:5865)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.lang.Var.invoke(Var.java:379)
    at nltry.core.<clinit>(Unknown Source)
Caused by: java.lang.IllegalArgumentException: No implementation of method: :make-reader of protocol: #'clojure.java.io/IOFactory found for class: nil
    at clojure.core$_cache_protocol_fn.invoke(core_deftype.clj:554)
    at clojure.java.io$fn__9115$G__9091__9122.invoke(io.clj:69)
    at clojure.java.io$reader.doInvoke(io.clj:102)
    at clojure.lang.RestFn.invoke(RestFn.java:410)
    at cljs.js_deps$goog_dependencies_STAR_.invoke(js_deps.clj:214)
    at clojure.lang.AFn.applyToHelper(AFn.java:152)
    at clojure.lang.AFn.applyTo(AFn.java:144)
    at clojure.core$apply.invoke(core.clj:630)
    at clojure.core$memoize$fn__5479.doInvoke(core.clj:6082)
    at clojure.lang.RestFn.invoke(RestFn.java:397)
    at cljs.js_deps$js_dependency_index.invoke(js_deps.clj:233)
    at cljs.env$default_compiler_env.invoke(env.clj:45)
    at cljs.env$default_compiler_env.invoke(env.clj:42)
    at lighttable.nrepl.cljs__init.load(Unknown Source)
    at lighttable.nrepl.cljs__init.<clinit>(Unknown Source)
    ... 58 more
%

@kohyama
Copy link
Author

kohyama commented Sep 18, 2015

It seems to be caused by http://dev.clojure.org/jira/browse/CLJ-1544 ...

@kohyama
Copy link
Author

kohyama commented Sep 18, 2015

The next release lein-light-nrepl 0.2.0 avoids this problem.
I tested with lein-light-nrepl 0.2.0 compiled from from the release pending source.
And it works well.
I use this self-built version of lein-light-nrepl until the 0.2.0 is formally released.
LightTable/Clojure#56

Thank you.

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