This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-10-18
Channels
- # announcements (8)
- # aws (5)
- # babashka (69)
- # beginners (37)
- # calva (222)
- # cider (10)
- # clj-commons (8)
- # clj-kondo (69)
- # cljdoc (5)
- # clojure (62)
- # clojure-dev (23)
- # clojure-europe (37)
- # clojure-italy (2)
- # clojure-nl (6)
- # clojure-sg (6)
- # clojure-uk (5)
- # clojurescript (25)
- # clojureverse-ops (12)
- # conjure (1)
- # cursive (1)
- # fulcro (9)
- # gorilla (1)
- # graalvm (6)
- # graphql (1)
- # gratitude (1)
- # honeysql (7)
- # introduce-yourself (4)
- # jobs (1)
- # kaocha (9)
- # keyboards (4)
- # leiningen (8)
- # lsp (21)
- # malli (9)
- # music (3)
- # nextjournal (17)
- # nrepl (6)
- # off-topic (10)
- # pathom (12)
- # portal (25)
- # reagent (8)
- # releases (1)
- # specter (1)
- # xtdb (1)
Hi folks, I am trying to set portal
up but I get the following exception (cut for brevity):
Caused by: java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/util/JacksonFeatureSet
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetPublicMethods(Class.java:2902)
at java.lang.Class.getMethods(Class.java:1615)
at clojure.lang.Reflector.getMethods(Reflector.java:498)
at clojure.lang.Compiler$HostExpr$Parser.parse(Compiler.java:996)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:7107)
... 143 more
Has anyone run into this before?Portal uses https://github.com/dakrone/cheshire (which I think uses jackson) for serialization. I wonder if you have a transitive dep that's causing a conflict :thinking_face:
Yes it seems like I need to do this:
[djblue/portal "0.16.2" :exclusions [org.clojure/clojure
org.clojure/spec.alpha
org.clojure/core.specs.alpha
com.fasterxml.jackson.core/jackson-annotations
com.fasterxml.jackson.core/jackson-core
com.fasterxml.jackson.core/jackson-databind]]
actually no, it seems portal
needs that old version
or prolly we can bump portal
's deps
I see - I actually copied [com.fasterxml.jackson.core/jackson-core "2.12.4"]
at the top of my lein :dependencies
and that worked
let me try to specify portal
's current version
I found out the culprit there:
$ lein deps :tree
Possibly confusing dependencies found:
[metosin/muuntaja "0.6.7"] -> [metosin/jsonista "0.2.6"] -> [com.fasterxml.jackson.core/jackson-databind "2.11.0"]
There's a reason we switched all of our app JSON dependencies to org.clojure/data.json
and away from Cheshire/jsonista stuff! 🙂
oh well that's good to know 🤷
I would say, for tooling, it really should avoid Cheshire/jsonista stuff if possible and rely on data.json
-- to avoid conflicts.
(several libs we rely on have an optional dependency on Cheshire and just disable JSON-related functionality if Cheshire isn't on the classpath -- and we rely on that disabling feature)
Now that data.json
is so much faster than it used to be, I see no reason to use those other libraries -- unless you have absolutely critical bottleneck performance around JSON serialization in your app (and have profiled it and proved that is the problem).
What annoys me is that so many libraries just drag these in as transitive deps in such a cavalier fashion 😞
We just started using Hato (instead of httpkit) and I was disappointed to see its JSON support is conditional on Cheshire -- but at least it is conditional and we can just ignore it and do our own JSON stuff externally via data.json
...
Portal was using transit-clj/s for a long time for serialization but it also had issues with transitive deps. Looks like the safest option is going to be data.json
My unscientific benchmark numbers say moving to data.json
is reasonable:
1000000 runs, 36062 msecs, (cson/write v edn)
1000000 runs, 15864 msecs, (cson/write v cheshire)
1000000 runs, 14466 msecs, (cson/write v data-json)
1000000 runs, 17095 msecs, (cson/read v edn)
1000000 runs, 11041 msecs, (cson/read v cheshire)
1000000 runs, 14207 msecs, (cson/read v data-json)
https://github.com/djblue/portal/commit/6a25a70e6f7212275cc1d8e0f6daa0d4e2e36a46 is slated for the next release 👌