This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-09-12
Channels
- # ai (1)
- # announcements (7)
- # babashka (32)
- # beginners (23)
- # biff (9)
- # calva (1)
- # cljs-dev (13)
- # clojure (32)
- # clojure-belgium (1)
- # clojure-chicago (15)
- # clojure-europe (24)
- # clojure-india (3)
- # clojure-nl (3)
- # clojure-norway (55)
- # clojure-uk (4)
- # clojurebridge (1)
- # clojurescript (5)
- # core-async (17)
- # data-science (9)
- # datomic (29)
- # events (3)
- # fulcro (16)
- # graalvm-mobile (4)
- # helix (15)
- # hyperfiddle (74)
- # introduce-yourself (1)
- # jobs (4)
- # kaocha (12)
- # leiningen (27)
- # lsp (16)
- # shadow-cljs (6)
- # spacemacs (20)
- # sql (27)
- # squint (7)
- # tools-deps (29)
- # vim (2)
- # xtdb (10)
I'm trying to get babashka working in a sandbox. Specifically, I'm trying to generate an uberjar of deps to use elsewhere with bb --config bb.edn uberjar deps.jar
, and I'm getting this error:
Error: Could not find or load main class clojure.main
Caused by: java.lang.ClassNotFoundException: clojure.main
Exception in thread "main" java.io.FileNotFoundException: .clojure/.cpcache/CD493EC38DE8FD326E3BA44059ED15FB.cp (No such file or directory)
Now that's not pointing at my ~/.clojure
, because that's outside the sandbox. So I've got a wrapper script for bb
which sets CLJ_CONFIG
to be in the current directory. I can see that directory, and there are cpcache entries in there:
ls 9/execroot/griffin/.clojure/.cpcache
97713C8154E4C4BD1CBB5856654237AD.basis
97713C8154E4C4BD1CBB5856654237AD.cp
but that... 'id', is not the same as the one referenced in the exception. So why is it generating a file with one ID in that directory, and then looking for a completely different one when it comes to run the main uberjar-generating command?Aah. I was on 1.3.179. Have upgraded to 1.3.184 and have got a different error. It no longer complains about the classpath, but it still can't find clojure.main
:
Clojure tools not yet in expected location: .deps.clj/clojure-tools-1.11.1.1403.jar
Downloading to .deps.clj/clojure-tools.zip
Unzipping .deps.clj/clojure-tools.zip ...
Successfully installed clojure tools!
Error: Could not find or load main class clojure.main
Caused by: java.lang.ClassNotFoundException: clojure.main
Exception in thread "main" clojure.lang.ExceptionInfo: babashka.process.Process@416433a5
I vaguely remember something with (System/getProperty "user.home")
and HOME
being dissimilar causing issues
As in the actual env var rather than a java property or similar? ${HOME}
isn't set in the sandbox env. I've explicitly set CLJ_CONFIG
and DEPS_CLJ_TOOLS_DIR
to be inside the sandbox
you could try to download the deps.clj script and just execute it with bb like this:
bb -cp nil ./deps.clj -Sdeps-file bb.edn
and then poke in the locally downloaded deps.clj script to see where something is going wrongHmm, I'm getting somewhere with looking at the cpcache directory. It's still referring to files in ~/.m2/repository
.
I mean, if you get clojure.main
not found for just bb and not invoking clojure itself, then this is a sign that something goes wrong while calculating the classpath
• bb
works (a babashka repl launches)
• bb clojure
works (a clojure repl launches)
• bb --config bb.edn uberjar deps.jar
fails
bb --config bb.edn
is already the default, so I don't understand why this fails, unless it's using an old cache.
Try wiping ~/.clojure/.cpcache
Hmm. With -Sdeps '{:mvn/local-repo "/tmp"}'
the .cpcache/*.cp
file is still referencing my home directory...
It's definiteyl something to do with the sandboxing and the setting of those 2 vars. If don't sandbox but still have the vars, it still fails. If I don't sandbox and don't override the vars it works fine
if you can give me instructions of how to replicate such a sandbox e.g. using docker perhaps that would help