graalvm

Discuss GraalVM related topics. Use clojure 1.10.2 or newer for all new projects. Contribute to https://github.com/clj-easy/graal-docs and https://github.com/BrunoBonacci/graalvm-clojure. GraalVM slack: https://www.graalvm.org/slack-invitation/.
dominicm 2020-09-20T15:59:21.024900Z

I'm struggling to understand what I'm doing wrong, does this error look familiar to anyone?

Exception in thread "main" java.lang.ExceptionInInitializerError
	at com.oracle.svm.core.classinitialization.ClassInitializationInfo.initialize(ClassInitializationInfo.java:291)
	at clojure.lang.Namespace.<init>(Namespace.java:34)
	at clojure.lang.Namespace.findOrCreate(Namespace.java:176)
	at clojure.lang.Var.internPrivate(Var.java:156)
	at dominic.httpkit.<clinit>(Unknown Source)
	at com.oracle.svm.core.classinitialization.ClassInitializationInfo.invokeClassInitializer(ClassInitializationInfo.java:351)
	at com.oracle.svm.core.classinitialization.ClassInitializationInfo.initialize(ClassInitializationInfo.java:271)
Caused by: java.io.FileNotFoundException: Could not locate clojure/core__init.class, clojure/core.clj or clojure/core.cljc on classpath.
	at clojure.lang.RT.load(RT.java:462)
	at clojure.lang.RT.load(RT.java:424)
	at clojure.lang.RT.<clinit>(RT.java:338)
	at com.oracle.svm.core.classinitialization.ClassInitializationInfo.invokeClassInitializer(ClassInitializationInfo.java:351)
	at com.oracle.svm.core.classinitialization.ClassInitializationInfo.initialize(ClassInitializationInfo.java:271)
	... 6 more
dominic.httpkit is tiny & simple

dominicm 2020-09-20T15:59:38.025Z

❯ cat src/dominic/httpkit.clj  
(ns dominic.httpkit
  (:gen-class)
  (:require [org.httpkit.server :refer :all]))

(defn app [req]
  {:status  200
   :headers {"Content-Type" "text/html"}
   :body    "hello HTTP!"})

(defn -main [& args]
  (run-server app {:port 8080})
  @(promise))

dominicm 2020-09-20T16:00:15.025100Z

I'm using clj -Spath for the -cp to native-image, so I would assume that clojure files should be included?

borkdude 2020-09-20T16:18:10.025500Z

maybe best to throw this up into a git repo

dominicm 2020-09-20T16:21:35.025600Z

OK, I have got it by fixing an "unrelated issue". Seems to have been caused by the lack of log4j on my classpath... weird!

borkdude 2020-09-20T16:22:03.025900Z

There's a hello world project in https://github.com/lread/clj-graal-docs