Unbound var when using Clojure 1.7

87 views
Skip to first unread message

Christoph Wagner

unread,
Aug 14, 2015, 7:03:05 AM8/14/15
to clojure-neo4j
Hi,

I've been using neocons 3.0.0 for some time now with Clojure 1.6.
When I upgrade to Clojure 1.7 the client stops working and I receive an error:

Caused by: java.lang.ClassCastException: clojure.lang.Var$Unbound cannot be cast to clojure.lang.MultiFn
      at clojurewerkz.neocons.rest.nodes__init.load(Unknown Source)
      at clojurewerkz.neocons.rest.nodes__init.(Unknown Source)

Did anyone else encounter this and can point my into the right direction to solve it?

Thanks,
Christoph

Rohit Aggarwal

unread,
Aug 14, 2015, 7:24:42 AM8/14/15
to clojure-neo4j
Christoph,
Would you be able to share a snippet of your code?

Thanks
Rohit

Christoph Wagner

unread,
Aug 14, 2015, 7:44:02 AM8/14/15
to clojure-neo4j
Hi Rohit,

I get this error as soon as I do "lein run". On startup neocons isn't even used yet. I create connections later on a per request base.
That's part of what confuses me so much.

The code interfacing to neocons is this:

(ns holytools.server.interfaces.neo4j
  (:require
    [holytools.server.interfaces.log :as log]
    [clojurewerkz.neocons.rest :as nr]
    [clojurewerkz.neocons.rest.nodes :as nn]
    [clojurewerkz.neocons.rest.relationships :as nrl]
    [clojurewerkz.neocons.rest.cypher :as cy]
    [clojurewerkz.neocons.rest.labels :as nl]))

(def server (atom "http://127.0.0.1:7474/db/data/"))
(defn init
  [url]
  (reset! server url))

(defn- connect
  "Create connection to specified database."
  []
  (nr/connect @server))

(defn node
  "Get a node by label and name"
  ([con label nname]
   (get (first (cy/tquery con (str "MATCH (n:" label ") where n.name={name} RETURN n") {:name nname})) "n"))
  ([label nname]
   (node (connect) label nname)))

(defn user
  "Get a user by name."
  ([con username]
   (:data (node con "user" username)))
  ([username]
   (:data (node "user" username))))


But the error is thrown as soon as this namespace is compiled.

Thanks again,
Christoph

Rohit Aggarwal

unread,
Aug 14, 2015, 9:22:15 AM8/14/15
to clojure-neo4j
Thanks Christoph.

With the example you've given, I don't get any errors. I do, however, warnings:

WARNING: update already refers to: #'clojure.core/update in namespace: clj-http.client, being replaced by: #'clj-http.client/update
WARNING: update already refers to: #'clojure.core/update in namespace: clojurewerkz.neocons.rest.relationships, being replaced by: #'clojurewerkz.neocons.rest.relationships/update
WARNING: update already refers to: #'clojure.core/update in namespace: clojurewerkz.neocons.rest.nodes, being replaced by: #'clojurewerkz.neocons.rest.nodes/update

If you update to the latest Neocons,
[clojurewerkz/neocons "3.1.0-beta3"]
 those warning should disappear. Again, I don't get any errors.


-Rohit

Christoph Wagner

unread,
Aug 14, 2015, 2:07:25 PM8/14/15
to clojure-neo4j
Hi Rahit,

Seeing that the code worked in your example I started to take my project apart and finally found the issue.
In my project.clj I had the core namespace in the aot field:
:aot [holytools.server.core]
After removing this it runs as it should.

Thanks again for you help.
Have a nice day,
Christoph
Reply all
Reply to author
Forward
0 new messages