This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-04-09
Channels
- # announcements (3)
- # babashka (1)
- # beginners (66)
- # clj-kondo (2)
- # cljdoc (46)
- # cljs-dev (7)
- # clojure (16)
- # clojure-australia (2)
- # clojure-china (1)
- # clojure-europe (3)
- # clojure-hk (1)
- # clojure-japan (1)
- # clojure-korea (1)
- # clojure-my (1)
- # clojure-sg (1)
- # clojure-taiwan (1)
- # clojurescript (4)
- # community-development (53)
- # conjure (6)
- # css (7)
- # cursive (6)
- # datascript (1)
- # datomic (5)
- # exercism (5)
- # graalvm (12)
- # helix (8)
- # jobs-rus (1)
- # kaocha (1)
- # lsp (19)
- # nrepl (1)
- # overtone (2)
- # pedestal (1)
- # polylith (2)
- # portal (2)
- # react (25)
- # reagent (1)
- # shadow-cljs (7)
- # spacemacs (8)
- # vim (9)
Hello! I'm trying to build a native image from a jar file inside a container but with mixed success; I'm stuck at this problem now where I can't even run the binary after successfully compiled it -
Exception in thread "main" java.lang.ExceptionInInitializerError
Caused by: java.io.FileNotFoundException: Could not locate clojure/core/server__init.class, clojure/core/server.clj or clojure/core/server.cljc on classpath.
My Dockerfile:
FROM
...
RUN native-image \
-jar core-0.1.0-SNAPSHOT.jar \
--no-fallback \
--no-server \
--verbose \
--enable-url-protocols=http,https \
--report-unsupported-elements-at-runtime \
--initialize-at-run-time=com.taoensso.faraday,org.httpkit.client \
--initialize-at-build-time=clojure,org.httpkit,cheshire.core \
the-jar
I've been trying to mix and match the different classes to initialise at build and runtime without any real success.
Any tips would be extremely helpful 🙂Yeah I will probably try it, this is quite frustrating! Would be nice to figure out why it's broken though
it's just a result of clojure doing dynamic things. if you initialize clojure itself at build time it will work
Using clj-easy
leads to another error at buildtime -
#11 22.27 Error: Classes that should be initialized at run time got initialized during image building:
#11 22.27 com.fasterxml.jackson.core.io.SerializedString was unintentionally initialized at build time.
I'm using cheshire I guess that is the one causing it, adding it to --initialize-at-run-time=
does not solve the issue either 😕Here is a project with example config: https://github.com/clj-easy/graal-config/blob/master/config/cheshire/cheshire/resources/META-INF/native-image/cheshire/cheshire/native-image.properties