java.lang.StackOverflowError in clojure.java.data from-java - clojure

I have a Java class generated by Protocol Buffers called TextLine. When I instantiate the Java object with:
(def tb (-> (TextLine/newBuilder) (.setText "this is a text line") (.build)))
And then call:
(from-java tb)
I receive a StackOverflowError:
java.lang.StackOverflowError: null
at java.lang.Class.getMethods (Class.java:1614)
clojure.lang.Reflector.getMethods (Reflector.java:373)
clojure.lang.Reflector.invokeNoArgInstanceMember (Reflector.java:311)
clojure.java.data$add_getter_fn.invokeStatic (data.clj:38)
clojure.java.data$add_getter_fn.invoke (data.clj:37)
clojure.core.protocols$fn__6755.invokeStatic (protocols.clj:167)
clojure.core.protocols/fn (protocols.clj:124)
clojure.core.protocols$fn__6710$G__6705__6719.invoke (protocols.clj:19)
clojure.core.protocols$seq_reduce.invokeStatic (protocols.clj:31)
clojure.core.protocols$fn__6732.invokeStatic (protocols.clj:75)
clojure.core.protocols/fn (protocols.clj:75)
clojure.core.protocols$fn__6684$G__6679__6697.invoke (protocols.clj:13)
clojure.core$reduce.invokeStatic (core.clj:6545)
clojure.core$reduce.invoke (core.clj:6527)
clojure.java.data$eval554$fn__555.invoke (data.clj:135)
clojure.lang.MultiFn.invoke (MultiFn.java:229)
clojure.java.data$make_getter_fn$fn__501.invoke (data.clj:35)
clojure.java.data$eval554$fn__555$iter__556__560$fn__561.invoke (data.clj:136)
clojure.lang.LazySeq.sval (LazySeq.java:40)
clojure.lang.LazySeq.seq (LazySeq.java:49)
clojure.lang.Cons.next (Cons.java:39)
clojure.lang.RT.next (RT.java:688)
clojure.core$next__4341.invokeStatic (core.clj:64)
clojure.core.protocols$fn__6755.invokeStatic (protocols.clj:168)
clojure.core.protocols/fn (protocols.clj:124)
clojure.core.protocols$fn__6710$G__6705__6719.invoke (protocols.clj:19)
clojure.core.protocols$seq_reduce.invokeStatic (protocols.clj:31)
clojure.core.protocols$fn__6738.invokeStatic (protocols.clj:75)
clojure.core.protocols/fn (protocols.clj:75)
clojure.core.protocols$fn__6684$G__6679__6697.invoke (protocols.clj:13)
clojure.core$reduce.invokeStatic (core.clj:6545)
clojure.core$into.invokeStatic (core.clj:6610)
clojure.core$into.invoke (core.clj:6604)
clojure.java.data$eval554$fn__555.invoke (data.clj:136)
clojure.lang.MultiFn.invoke (MultiFn.java:229)
clojure.java.data$make_getter_fn$fn__501.invoke (data.clj:35)
clojure.java.data$eval554$fn__555$iter__556__560$fn__561.invoke (data.clj:136)
clojure.lang.LazySeq.sval (LazySeq.java:40)
clojure.lang.LazySeq.seq (LazySeq.java:49)
clojure.lang.Cons.next (Cons.java:39)
clojure.lang.RT.next (RT.java:688)
clojure.core$next__4341.invokeStatic (core.clj:64)
clojure.core.protocols$fn__6755.invokeStatic (protocols.clj:168)
clojure.core.protocols/fn (protocols.clj:124)
clojure.core.protocols$fn__6710$G__6705__6719.invoke (protocols.clj:19)
clojure.core.protocols$seq_reduce.invokeStatic (protocols.clj:31)
clojure.core.protocols$fn__6738.invokeStatic (protocols.clj:75)
clojure.core.protocols/fn (protocols.clj:75)
clojure.core.protocols$fn__6684$G__6679__6697.invoke (protocols.clj:13)
clojure.core$reduce.invokeStatic (core.clj:6545)
clojure.core$into.invokeStatic (core.clj:6610)
clojure.core$into.invoke (core.clj:6604)
clojure.java.data$eval554$fn__555.invoke (data.clj:136)
clojure.lang.MultiFn.invoke (MultiFn.java:229)
clojure.java.data$make_getter_fn$fn__501.invoke (data.clj:35)
clojure.java.data$eval554$fn__555$iter__556__560$fn__561.invoke (data.clj:136)
clojure.lang.LazySeq.sval (LazySeq.java:40)
clojure.lang.LazySeq.seq (LazySeq.java:49)
clojure.lang.Cons.next (Cons.java:39)
clojure.lang.RT.next (RT.java:688)
clojure.core$next__4341.invokeStatic (core.clj:64)
clojure.core.protocols$fn__6755.invokeStatic (protocols.clj:168)
clojure.core.protocols/fn (protocols.clj:124)
clojure.core.protocols$fn__6710$G__6705__6719.invoke (protocols.clj:19)
....
Any ideas on what could be causing this or the best way to troubleshoot it? I'd really like to interface with the Java object as a Clojure map.

I wouldn't recommend using clojure.data.java/from-java for much of anything. The idea that simple function can translate an arbitrary Java object into a reasonable Clojure map without any domain knowledge of the source object is wishful thinking.
I hadn't heard of it before today, but I went and looked at the source and as expected it is basically just an extension of clojure.core/bean, another hopeful attempt at an impossible problem. Specifically, it uses javabean introspection to try to guess what getters and setters represent meaningful fields. Now, However, like many Java classes that weren't designed to be used as beans, protobuf classes contain circular references, which means that recursively bean-ing them up is an infinite task, leading eventually to a stack overflow.
What to do instead? I would recommend just working with the generated Java protobuf classes through Java interop, or perhaps trying to find a good Clojure protobuf library. Don't try to convert the Java objects into idiomatic Clojure data.

Related

Deploy clojure packages to clojar

I am trying to deploy a package to clojars.
When I run lein deploy clojars command, I get
following error
java.lang.IllegalArgumentException: Must provide valid :files to deploy-artifacts
at cemerick.pomegranate.aether$deploy_artifacts.invokeStatic (aether.clj:346)
cemerick.pomegranate.aether$deploy_artifacts.doInvoke (aether.clj:312)
clojure.lang.RestFn.applyTo (RestFn.java:137)
clojure.core$apply.invokeStatic (core.clj:665)
clojure.core$apply.invoke (core.clj:660)
cemerick.pomegranate.aether$deploy.invokeStatic (aether.clj:431)
cemerick.pomegranate.aether$deploy.doInvoke (aether.clj:395)
clojure.lang.RestFn.invoke (RestFn.java:1096)
leiningen.deploy$deploy.invokeStatic (deploy.clj:235)
leiningen.deploy$deploy.doInvoke (deploy.clj:172)
clojure.lang.RestFn.invoke (RestFn.java:470)
clojure.lang.AFn.applyToHelper (AFn.java:165)
clojure.lang.RestFn.applyTo (RestFn.java:132)
clojure.lang.Var.applyTo (Var.java:705)
clojure.core$apply.invokeStatic (core.clj:667)
clojure.core$apply.invoke (core.clj:660)
leiningen.core.main$partial_task$fn__7330.doInvoke (main.clj:284)
clojure.lang.RestFn.applyTo (RestFn.java:139)
clojure.lang.AFunction$1.doInvoke (AFunction.java:31)
clojure.lang.RestFn.applyTo (RestFn.java:137)
clojure.core$apply.invokeStatic (core.clj:667)
clojure.core$apply.invoke (core.clj:660)
leiningen.core.main$apply_task.invokeStatic (main.clj:334)
leiningen.core.main$apply_task.invoke (main.clj:320)
leiningen.core.main$resolve_and_apply.invokeStatic (main.clj:343)
leiningen.core.main$resolve_and_apply.invoke (main.clj:336)
leiningen.core.main$_main$fn__7419.invoke (main.clj:453)
leiningen.core.main$_main.invokeStatic (main.clj:442)
leiningen.core.main$_main.doInvoke (main.clj:439)
clojure.lang.RestFn.applyTo (RestFn.java:137)
clojure.lang.Var.applyTo (Var.java:705)
clojure.core$apply.invokeStatic (core.clj:665)
clojure.main$main_opt.invokeStatic (main.clj:514)
clojure.main$main_opt.invoke (main.clj:510)
clojure.main$main.invokeStatic (main.clj:664)
clojure.main$main.doInvoke (main.clj:616)
clojure.lang.RestFn.applyTo (RestFn.java:137)
clojure.lang.Var.applyTo (Var.java:705)
clojure.main.main (main.java:40)
Not sure whats the requirement around :files option.
Any help is appreciated.
Thanks
Update
Here is the link to the project https://github.com/ludbek/sql-compose
The issue has been fixed. Not sure what went wrong with lein. Instead of using lein I used mvn to deploy the package.
The blog post below was helpful.
https://oli.me.uk/clojure-projects-from-scratch/

Clojurescript repl trying to invoke Clojure function from the Transit library

I have both the cognitect.transit-clj and cognitect.transit-cljs dependencies because my project is Clojure on the backend and CLJS on the frontend. I'm connecting to a shadow-cljs repl in cider with cider-connect.
In the repl, I do:
(require '[cognitect.transit :as xit])
(def my-writer (xit/writer :json))
I get this error:
Execution error (ArityException) at nrepl.middleware.interruptible-eval/evaluate$fn (interruptible_eval.clj:91).
Wrong number of args (1) passed to: cognitect.transit/writer
It appears that it's trying to invoke the java version of transmit/writer. Is something wrong with my dependencies or setup?
Here's the full stack trace:
clojure.lang.Compiler$CompilerException: Syntax error macroexpanding at (NO_SOURCE_FILE:45:29).
#:clojure.error{:phase :execution, :line 45, :column 29, :source "NO_SOURCE_FILE"}
at clojure.lang.Compiler$InvokeExpr.eval (Compiler.java:3707)
clojure.lang.Compiler$DefExpr.eval (Compiler.java:457)
clojure.lang.Compiler.eval (Compiler.java:7182)
clojure.lang.Compiler.eval (Compiler.java:7132)
clojure.core$eval.invokeStatic (core.clj:3214)
clojure.core$eval.invoke (core.clj:3210)
nrepl.middleware.interruptible_eval$evaluate$fn__42793.invoke (interruptible_eval.clj:91)
clojure.main$repl$read_eval_print__9086$fn__9089.invoke (main.clj:437)
clojure.main$repl$read_eval_print__9086.invoke (main.clj:437)
clojure.main$repl$fn__9095.invoke (main.clj:458)
clojure.main$repl.invokeStatic (main.clj:458)
clojure.main$repl.doInvoke (main.clj:368)
clojure.lang.RestFn.invoke (RestFn.java:1523)
nrepl.middleware.interruptible_eval$evaluate.invokeStatic (interruptible_eval.clj:84)
nrepl.middleware.interruptible_eval$evaluate.invoke (interruptible_eval.clj:56)
nrepl.middleware.interruptible_eval$interruptible_eval$fn__42819$fn__42823.invoke (interruptible_eval.clj:155)
clojure.lang.AFn.run (AFn.java:22)
nrepl.middleware.session$session_exec$main_loop__43068$fn__43072.invoke (session.clj:190)
nrepl.middleware.session$session_exec$main_loop__43068.invoke (session.clj:189)
clojure.lang.AFn.run (AFn.java:22)
java.lang.Thread.run (Thread.java:748)
Caused by: clojure.lang.ArityException: Wrong number of args (1) passed to: cognitect.transit/writer
at clojure.lang.AFn.throwArity (AFn.java:429)
clojure.lang.AFn.invoke (AFn.java:32)
clojure.lang.AFn.applyToHelper (AFn.java:154)
clojure.lang.AFn.applyTo (AFn.java:144)
clojure.lang.Compiler$InvokeExpr.eval (Compiler.java:3702)
clojure.lang.Compiler$DefExpr.eval (Compiler.java:457)
clojure.lang.Compiler.eval (Compiler.java:7182)
clojure.lang.Compiler.eval (Compiler.java:7132)
clojure.core$eval.invokeStatic (core.clj:3214)
clojure.core$eval.invoke (core.clj:3210)
nrepl.middleware.interruptible_eval$evaluate$fn__42793.invoke (interruptible_eval.clj:91)
clojure.main$repl$read_eval_print__9086$fn__9089.invoke (main.clj:437)
clojure.main$repl$read_eval_print__9086.invoke (main.clj:437)
clojure.main$repl$fn__9095.invoke (main.clj:458)
clojure.main$repl.invokeStatic (main.clj:458)
clojure.main$repl.doInvoke (main.clj:368)
clojure.lang.RestFn.invoke (RestFn.java:1523)
nrepl.middleware.interruptible_eval$evaluate.invokeStatic (interruptible_eval.clj:84)
nrepl.middleware.interruptible_eval$evaluate.invoke (interruptible_eval.clj:56)
nrepl.middleware.interruptible_eval$interruptible_eval$fn__42819$fn__42823.invoke (interruptible_eval.clj:155)
clojure.lang.AFn.run (AFn.java:22)
nrepl.middleware.session$session_exec$main_loop__43068$fn__43072.invoke (session.clj:190)
nrepl.middleware.session$session_exec$main_loop__43068.invoke (session.clj:189)
clojure.lang.AFn.run (AFn.java:22)
java.lang.Thread.run (Thread.java:748)
I do not know enough about cider-connect but it is very likely that you are just connected to the CLJ REPL and not the actual CLJS REPL you are looking for. A connection always starts out as CLJ and your editor has to "upgrade" it to CLJS. Maybe this is still current?
For plain shadow-cljs you get to the CLJS REPL directly via shadow-cljs cljs-repl app (assuming :app is your build id). For nREPL your editor is in control. I'm sure there is a command for that.

Leiningen throws clojure.lang.PersistentVector cannot be cast to clojure.lang.Named

I'm a Java developer taking first steps with Clojure. I have put together a simple project using Leiningen 2.8.1 and Clojure 1.9.0. The code of my project is available here.
My problem is very simple. When I run "lein" from the console I get this error:
java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to clojure.lang.Named
at clojure.core$name.invokeStatic (core.clj:1546)
clojure.core$name.invoke (core.clj:1540)
leiningen.core.project$absolutize_path.invokeStatic (project.clj:453)
leiningen.core.project$absolutize_path.invoke (project.clj:452)
clojure.core.protocols$iter_reduce.invokeStatic (protocols.clj:49)
clojure.core.protocols$fn__6744.invokeStatic (protocols.clj:75)
clojure.core.protocols/fn (protocols.clj:75)
clojure.core.protocols$fn__6684$G__6679__6697.invoke (protocols.clj:13)
clojure.core$reduce.invokeStatic (core.clj:6545)
clojure.core$reduce.invoke (core.clj:6527)
leiningen.core.project$absolutize_paths.invokeStatic (project.clj:463)
leiningen.core.project$absolutize_paths.invoke (project.clj:462)
leiningen.core.project$init_profiles.invokeStatic (project.clj:887)
leiningen.core.project$init_profiles.doInvoke (project.clj:865)
clojure.lang.RestFn.invoke (RestFn.java:425)
leiningen.core.project$init_project.invokeStatic (project.clj:950)
leiningen.core.project$init_project.invoke (project.clj:942)
leiningen.core.project$read.invokeStatic (project.clj:1023)
leiningen.core.project$read.invoke (project.clj:1020)
leiningen.core.project$read.invokeStatic (project.clj:1024)
leiningen.core.project$read.invoke (project.clj:1020)
leiningen.core.main$_main$fn__4734.invoke (main.clj:416)
leiningen.core.main$_main.invokeStatic (main.clj:411)
leiningen.core.main$_main.doInvoke (main.clj:408)
clojure.lang.RestFn.invoke (RestFn.java:397)
clojure.lang.Var.invoke (Var.java:375)
clojure.lang.AFn.applyToHelper (AFn.java:152)
clojure.lang.Var.applyTo (Var.java:700)
clojure.core$apply.invokeStatic (core.clj:646)
clojure.main$main_opt.invokeStatic (main.clj:314)
clojure.main$main_opt.invoke (main.clj:310)
clojure.main$main.invokeStatic (main.clj:421)
clojure.main$main.doInvoke (main.clj:384)
clojure.lang.RestFn.invoke (RestFn.java:421)
clojure.lang.Var.invoke (Var.java:383)
clojure.lang.AFn.applyToHelper (AFn.java:156)
clojure.lang.Var.applyTo (Var.java:700)
clojure.main.main (main.java:37)
It doesn't matter if I run lein or lein test, the result is the same. And I don't see any reference to my code in the stack trace, so I'm clueless.
Any ideas of what's wrong?
Thanks in advance.
Your project.clj file is missing a closing bracket here.
:dependencies [[org.clojure/clojure "1.8.0"]
[mount "0.1.11"] ;; delete extra bracket
[midje "1.9.1"]
[com.datomic/datomic-free "0.9.5656"]] ;; add closing bracket

cannot run lein script

I've downloaded lein, put it in my /bin folder, and made it executable. I've also downloaded java:
$java -version
java version "1.7.0_65"
But I get the following error upon running the command:
$lein
java.lang.ClassCastException: clojure.lang.Symbol cannot be cast to java.util.Map$Entry
at clojure.lang.APersistentMap$ValSeq.first (APersistentMap.java:185)
clojure.lang.RT.first (RT.java:577)
clojure.core$first.invoke (core.clj:55)
clojure.core$map$fn__4245.invoke (core.clj:2559)
clojure.lang.LazySeq.sval (LazySeq.java:40)
clojure.lang.LazySeq.seq (LazySeq.java:49)
clojure.lang.RT.seq (RT.java:484)
clojure.core$seq.invoke (core.clj:133)
clojure.core$zipmap.invoke (core.clj:2788)
leiningen.core.utils$map_vals.doInvoke (utils.clj:115)
clojure.lang.RestFn.invoke (RestFn.java:442)
leiningen.core.user/fn (user.clj:69)
clojure.lang.AFn.applyToHelper (AFn.java:154)
clojure.lang.AFn.applyTo (AFn.java:144)
clojure.core$apply.invoke (core.clj:624)
clojure.core$memoize$fn__5097.doInvoke (core.clj:5846)
clojure.lang.RestFn.invoke (RestFn.java:408)
leiningen.core.user/fn (user.clj:85)
clojure.lang.AFn.applyToHelper (AFn.java:152)
clojure.lang.AFn.applyTo (AFn.java:144)
clojure.core$apply.invoke (core.clj:624)
clojure.core$memoize$fn__5097.doInvoke (core.clj:5846)
clojure.lang.RestFn.invoke (RestFn.java:397)
leiningen.core.project$read_profiles.invoke (project.clj:622)
leiningen.core.project$project_with_profiles.invoke (project.clj:736)
leiningen.core.main$_main$fn__5979.invoke (main.clj:358)
leiningen.core.main$_main.doInvoke (main.clj:353)
clojure.lang.RestFn.invoke (RestFn.java:397)
clojure.lang.Var.invoke (Var.java:375)
clojure.lang.AFn.applyToHelper (AFn.java:152)
clojure.lang.Var.applyTo (Var.java:700)
clojure.core$apply.invoke (core.clj:624)
clojure.main$main_opt.invoke (main.clj:315)
clojure.main$main.doInvoke (main.clj:420)
clojure.lang.RestFn.invoke (RestFn.java:421)
clojure.lang.Var.invoke (Var.java:383)
clojure.lang.AFn.applyToHelper (AFn.java:156)
clojure.lang.Var.applyTo (Var.java:700)
clojure.main.main (main.java:37)
I get this when I try to make my first project also:
$lein new compojure-app guestbook
java.lang.ClassCastException: clojure.lang.Symbol cannot be cast to java.util.Map$Entry
at clojure.lang.APersistentMap$ValSeq.first (APersistentMap.java:185)
clojure.lang.RT.first (RT.java:577)
clojure.core$first.invoke (core.clj:55)
clojure.core$map$fn__4245.invoke (core.clj:2559)
clojure.lang.LazySeq.sval (LazySeq.java:40)
clojure.lang.LazySeq.seq (LazySeq.java:49)
clojure.lang.RT.seq (RT.java:484)
clojure.core$seq.invoke (core.clj:133)
clojure.core$zipmap.invoke (core.clj:2788)
leiningen.core.utils$map_vals.doInvoke (utils.clj:115)
clojure.lang.RestFn.invoke (RestFn.java:442)
leiningen.core.user/fn (user.clj:69)
clojure.lang.AFn.applyToHelper (AFn.java:154)
clojure.lang.AFn.applyTo (AFn.java:144)
clojure.core$apply.invoke (core.clj:624)
clojure.core$memoize$fn__5097.doInvoke (core.clj:5846)
clojure.lang.RestFn.invoke (RestFn.java:408)
leiningen.core.user/fn (user.clj:85)
clojure.lang.AFn.applyToHelper (AFn.java:152)
clojure.lang.AFn.applyTo (AFn.java:144)
clojure.core$apply.invoke (core.clj:624)
clojure.core$memoize$fn__5097.doInvoke (core.clj:5846)
clojure.lang.RestFn.invoke (RestFn.java:397)
leiningen.core.project$read_profiles.invoke (project.clj:622)
leiningen.core.project$project_with_profiles.invoke (project.clj:736)
leiningen.core.main$_main$fn__5979.invoke (main.clj:358)
leiningen.core.main$_main.doInvoke (main.clj:353)
clojure.lang.RestFn.invoke (RestFn.java:436)
clojure.lang.Var.invoke (Var.java:388)
clojure.lang.AFn.applyToHelper (AFn.java:160)
clojure.lang.Var.applyTo (Var.java:700)
clojure.core$apply.invoke (core.clj:624)
clojure.main$main_opt.invoke (main.clj:315)
clojure.main$main.doInvoke (main.clj:420)
clojure.lang.RestFn.invoke (RestFn.java:482)
clojure.lang.Var.invoke (Var.java:401)
clojure.lang.AFn.applyToHelper (AFn.java:171)
clojure.lang.Var.applyTo (Var.java:700)
clojure.main.main (main.java:37)
What is the problem here? Thank you in advance.
As per Alex's comment, the problem was solved by replacing the malformed .lein/profiles.clj:
$nano .lein/profiles.clj
[lein-ancient "0.5.5"]
with a properly formed profile . I used this profile, found at gist.github.com/devn/4403577 :
{:user {:plugins [[lein-swank "1.4.5"]
;; [lein-pedantic "0.0.5"]
;; [lein-ritz "0.6.0"]
[lein-checkout-deps "1.0.0"]
;; [lein-haml-sass "0.2.4"]
[lein-midje "2.0.1"]
[lein-kibit "0.0.7"]]}
{:dependencies [[slamhound "1.3.0"]]}
{:aliases {"slamhound" ["run" "-m" "slam.hound"]}}}

How do I set local-paths for ritz.nrepl.middleware/wrap-javadoc?

In api docs for nrepl-middleware wrap-javadoc it says that it 'accepts local-paths a space separate list of paths'
How do I set this?
I've tried the following in my profiles.clj
{:user {:plugins []
:jvm-opts ["-Xmx4G"]
:injections [(require 'clojure.repl)]
:warn-on-reflection true
:dependencies [[ritz/ritz-nrepl-middleware "0.7.0"]]
:repl-options {:nrepl-middleware
[ritz.nrepl.middleware.javadoc/wrap-javadoc :local-paths "/usr/local/share/javadocs/7/docs/api"]
}}}
But that causes the following exception when I execute nrepl-jack-in
Starting nREPL server...
Mark set
error in process sentinel: nrepl-server-sentinel: Could not start nREPL server: Reflection warning, NO_SOURCE_PATH:1:483 - reference to field getLocalPort can't be resolved.
Exception in thread "main" java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn
at clojure.core$comp$fn__4166.doInvoke(core.clj:2347)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.tools.nrepl.server$default_handler.doInvoke(server.clj:89)
at clojure.lang.RestFn.invoke(RestFn.java:436)
at user$eval1192.invoke(NO_SOURCE_FILE:1)
at clojure.lang.Compiler.eval(Compiler.java:6619)
at clojure.lang.Compiler.eval(Compiler.java:6609)
at clojure.lang.Compiler.eval(Compiler.java:6582)
at clojure.core$eval.invoke(core.clj:2852)
at clojure.main$eval_opt.invoke(main.clj:308)
at clojure.main$initialize.invoke(main.clj:327)
at clojure.main$null_opt.invoke(main.clj:362)
at clojure.main$main$fn__6661.invoke(main.clj:440)
at clojure.main$main.doInvoke(main.clj:437)
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)
Subprocess failed
If I wrap :local-paths "..." in a map I don't get any javadoc middleware
If you look at the example of the nrepl-middleware on its github page, you will find that the vector to :nrepl-middleware sbould be a vector of middleware functions where as you are passing it a string path and that's why the exception "String cannot be cast to IFn".
As far as the local-paths is concerned that's something which is send by the nrepl client in the java-doc request itself. You can set local-paths in Emacs by calling:
(setq nrepl-ritz-javadoc-local-paths (list "/usr/local/share/javadocs/7/docs/api"))