graalvm

2024-10-30T18:15:39.392639Z

Hello everyone! I know that error was discussed several years ago here, but I still can't solve it:

Caused by: java.io.FileNotFoundException: Could not locate clojure/core/server__init.class, clojure/core/server.clj or clojure/core/server.cljc on classpatth
Full stacktrace in thread

2024-10-30T18:16:11.799699Z

Exception in thread "main" java.lang.ExceptionInInitializerError
	at java.base@23.0.1/java.lang.invoke.DirectMethodHandle.ensureInitialized(DirectMethodHandle.java:328)
	at java.base@23.0.1/java.lang.invoke.DirectMethodHandle.internalMemberNameEnsureInit(DirectMethodHandle.java:335)
Caused by: java.io.FileNotFoundException: Could not locate clojure/core/server__init.class, clojure/core/server.clj or clojure/core/server.cljc on classpath.
	at clojure.lang.RT.load(RT.java:482)
	at clojure.lang.RT.load(RT.java:444)
	at clojure.core$load$fn__6931.invoke(core.clj:6189)
	at clojure.core$load.invokeStatic(core.clj:6188)
	at clojure.core$load.doInvoke(core.clj:6172)
	at clojure.lang.RestFn.invoke(RestFn.java:411)
	at clojure.core$load_one.invokeStatic(core.clj:5961)
	at clojure.core$load_one.invoke(core.clj:5956)
	at clojure.core$load_lib$fn__6873.invoke(core.clj:6003)
	at clojure.core$load_lib.invokeStatic(core.clj:6002)
	at clojure.core$load_lib.doInvoke(core.clj:5981)
	at clojure.lang.RestFn.applyTo(RestFn.java:145)
	at clojure.core$apply.invokeStatic(core.clj:669)
	at clojure.core$load_libs.invokeStatic(core.clj:6044)
	at clojure.core$load_libs.doInvoke(core.clj:6028)
	at clojure.lang.RestFn.applyTo(RestFn.java:140)
	at clojure.core$apply.invokeStatic(core.clj:669)
	at clojure.core$require.invokeStatic(core.clj:6066)
	at clojure.core$require.doInvoke(core.clj:6066)
	at clojure.lang.RestFn.invoke(RestFn.java:411)
	at clojure.lang.Var.invoke(Var.java:386)
	at clojure.lang.RT.doInit(RT.java:511)
	at clojure.lang.RT.init(RT.java:487)
	at clojure.lang.Util.loadWithClass(Util.java:248)
	at laniakea_stars_bot.bootstrap.<clinit>(Unknown Source)
	... 2 more

2024-10-30T18:17:22.937809Z

native-image -jar target/laniakea-stars-bot.jar \
             -H:+ReportExceptionStackTraces \
             -H:Log=registerResource:verbose \
             -H:+PrintClassInitialization \
             -J-Dclojure.spec.skip-macros=true \
             -J-Dclojure.compiler.direct-linking=true \
             --initialize-at-build-time=clojure,clojure.core.server \
             --report-unsupported-elements-at-runtime \
             --no-fallback \
             --native-image-info \
             -Djdk.graal.LogFile=./graal.log \
             -o lambda
And clojure is in :deps

borkdude 2024-10-30T18:22:45.547049Z

Try adding https://github.com/clj-easy/graal-build-time I think initialize-at-build-time isn't fully specifying all your loaded namespaces. If that doesn't work, try running a small test project as specified here to see if you can at least get that going: https://github.com/clj-easy/graal-docs

👀 1
âž• 1
2024-11-02T20:09:42.996489Z

Yes, this thing works as expected, nice, thank you