This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-12-31
Channels
- # adventofcode (15)
- # announcements (3)
- # babashka (38)
- # beginners (121)
- # calva (29)
- # cider (21)
- # circleci (1)
- # clojure (177)
- # clojure-europe (7)
- # clojure-france (2)
- # clojure-nl (7)
- # clojure-spec (3)
- # clojure-switzerland (5)
- # clojure-uk (4)
- # clojurescript (10)
- # code-reviews (1)
- # conjure (19)
- # deps-new (2)
- # emacs (5)
- # fulcro (52)
- # graalvm (13)
- # kaocha (1)
- # malli (1)
- # off-topic (6)
- # pathom (5)
- # re-frame (17)
- # reagent (14)
- # remote-jobs (1)
- # rewrite-clj (5)
- # robots (1)
- # shadow-cljs (13)
- # sql (38)
- # tools-deps (16)
- # xtdb (99)
Happy NYE everyone!
I was curious if anyone has seen the following error when the clojure
command is run:
Error building classpath. class java.util.HashMap$Node cannot be cast to class java.util.HashMap$TreeNode (java.util.HashMap$Node and java.util.HashMap$TreeNode are in module java.base of loader 'bootstrap')
I’m on clj version: 1.10.1.727
It seems to be intermittent but I’ve only seen it when clj is run with -Sdeps
and -Sforce
. I’ve seen this error thrown with both the -e
and the -m
flags used.@splayemu I wonder if you might be hitting a race condition when it is trying to figure out dependencies in parallel for some reason? You can try adding -Sthreads 1
to force it to be single-threaded.
thank you! It’s been popping up a bunch on our CI lately so I’ll give that a go and report back if it solves the problem.
Does it force the whole clojure process to only use 1 thread, or does it just change the classpath generation / clojure initialization?
Just the part that calculates/downloads dependencies. Once all the dependencies are figured out, the subsequent process that actually runs your code will run as normal.
Great, thanks 🙏
I'm a bit surprised folks don't run into this issue more often. I've never seen it happen -- not locally on my Mac, nor on our build/QA server -- but I have seen a handful of people run into it repeatedly.
hmm yeah I wonder what makes it more likely to happen… I haven’t seen it locally - only on our drone env
are you using any git deps or s3 maven repo deps?
yes we have our own maven repo in s3
and we also use git deps - though not used heavily
We also use a lot of :local/root
deps (not sure if that’s useful info for you)
yep, although that doesn't help narrow it down much :) s3 repos do dynamic loading of the s3 code so that's a known issue but your stack trace looks like something else. a lot of the maven model building stuff is not thread-safe.
sure, here is one:
Error building classpath. class java.util.HashMap$Node cannot be cast to class java.util.HashMap$TreeNode (java.util.HashMap$Node and java.util.HashMap$TreeNode are in module java.base of loader 'bootstrap')
java.lang.ClassCastException: class java.util.HashMap$Node cannot be cast to class java.util.HashMap$TreeNode (java.util.HashMap$Node and java.util.HashMap$TreeNode are in module java.base of loader 'bootstrap')
at java.base/java.util.HashMap$TreeNode.moveRootToFront(HashMap.java:1882)
at java.base/java.util.HashMap$TreeNode.treeify(HashMap.java:1998)
at java.base/java.util.HashMap.treeifyBin(HashMap.java:767)
at java.base/java.util.HashMap.putVal(HashMap.java:639)
at java.base/java.util.HashMap.put(HashMap.java:607)
at java.base/java.util.HashSet.add(HashSet.java:220)
at org.apache.maven.model.validation.DefaultModelValidator.validateId(DefaultModelValidator.java:847)
at org.apache.maven.model.validation.DefaultModelValidator.validateEffectiveDependency(DefaultModelValidator.java:659)
at org.apache.maven.model.validation.DefaultModelValidator.validateEffectiveDependencies(DefaultModelValidator.java:583)
at org.apache.maven.model.validation.DefaultModelValidator.validateEffectiveModel(DefaultModelValidator.java:368)
at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:494)
at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:440)
at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:430)
at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:292)
at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:171)
at org.eclipse.aether.internal.impl.DefaultRepositorySystem.readArtifactDescriptor(DefaultRepositorySystem.java:255)
at clojure.tools.deps.alpha.extensions.maven$eval816$fn__818.invoke(maven.clj:108)
at clojure.lang.MultiFn.invoke(MultiFn.java:244)
at clojure.tools.deps.alpha$expand_deps$children_task__1237$fn__1239$fn__1240.invoke(alpha.clj:250)
at clojure.tools.deps.alpha.util.concurrent$submit_task$task__500.invoke(concurrent.clj:33)
at clojure.lang.AFn.call(AFn.java:18)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
sure, here is one:
Error building classpath. class java.util.HashMap$Node cannot be cast to class java.util.HashMap$TreeNode (java.util.HashMap$Node and java.util.HashMap$TreeNode are in module java.base of loader 'bootstrap')
java.lang.ClassCastException: class java.util.HashMap$Node cannot be cast to class java.util.HashMap$TreeNode (java.util.HashMap$Node and java.util.HashMap$TreeNode are in module java.base of loader 'bootstrap')
at java.base/java.util.HashMap$TreeNode.moveRootToFront(HashMap.java:1882)
at java.base/java.util.HashMap$TreeNode.treeify(HashMap.java:1998)
at java.base/java.util.HashMap.treeifyBin(HashMap.java:767)
at java.base/java.util.HashMap.putVal(HashMap.java:639)
at java.base/java.util.HashMap.put(HashMap.java:607)
at java.base/java.util.HashSet.add(HashSet.java:220)
at org.apache.maven.model.validation.DefaultModelValidator.validateId(DefaultModelValidator.java:847)
at org.apache.maven.model.validation.DefaultModelValidator.validateEffectiveDependency(DefaultModelValidator.java:659)
at org.apache.maven.model.validation.DefaultModelValidator.validateEffectiveDependencies(DefaultModelValidator.java:583)
at org.apache.maven.model.validation.DefaultModelValidator.validateEffectiveModel(DefaultModelValidator.java:368)
at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:494)
at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:440)
at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:430)
at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:292)
at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:171)
at org.eclipse.aether.internal.impl.DefaultRepositorySystem.readArtifactDescriptor(DefaultRepositorySystem.java:255)
at clojure.tools.deps.alpha.extensions.maven$eval816$fn__818.invoke(maven.clj:108)
at clojure.lang.MultiFn.invoke(MultiFn.java:244)
at clojure.tools.deps.alpha$expand_deps$children_task__1237$fn__1239$fn__1240.invoke(alpha.clj:250)
at clojure.tools.deps.alpha.util.concurrent$submit_task$task__500.invoke(concurrent.clj:33)
at clojure.lang.AFn.call(AFn.java:18)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)