Fork me on GitHub
#graalvm
<
2022-08-04
>
djhaskin98702:08:01

Hello, how far have folks gotten with getting h2 databases to work with native-image compiled clojure programs? I am trying to use com.h2database/h2 with next.jdbc in my CLI application called zic. It all works when I run with java -jar on my uberjar, but when I compile with native-image I get a NullPointerException when the org.h2.engine.SessionRemote.connectEmbeddedOrServer function tries to run. I am using com.github.clj-easy/graal-config-h2, com.github.clj-easy/next.jdbc, etc. in my deps.edn file when I compile the program.

djhaskin98702:08:45

I understand timezones are going to possibly delay replies 🙂 I am in Utah, UTC -0600 timezone myself. My code is here: https://github.com/djhaskin987/zic/tree/feature/add-deps-edn (`djhaskin987/zic` github repo on the feature/add-deps-edn branch). To reproduce the error, you simply have to run make test-native from the root of the repo, if anyone is interested. Thanks!

borkdude09:08:33

@djhaskin987 Not sure about H2. I do have a config for HSQLDB

borkdude09:08:20

sqlite is also known to work well with graalvm

🤯 1
Karol Wójcik09:08:29

H2 should work I think. At least it was working for latest dev version

Karol Wójcik09:08:22

@djhaskin987 you can try this https://github.com/oracle/graalvm-reachability-metadata/blob/master/metadata/com.h2database/h2/2.1.210/reflect-config.json config. We made clj-easy config repository before „conditions” were even the thing. @borkdude I’m not sure what to do with clj-easy/graal-config. I would love the GraalVM team to allow us putting our configs for Java & Clj libs on their repository. From clj-easy side we would need additional tooling for feeding the native-image with those configurations in Clojure.

👀 1
gratitude-thank-you 1