sqlite-jdbc: native image error

  • graalvm version:
openjdk 21 2023-09-19
OpenJDK Runtime Environment GraalVM CE 21+35.1 (build 21+35-jvmci-23.1-b15)
OpenJDK 64-Bit Server VM GraalVM CE 21+35.1 (build 21+35-jvmci-23.1-b15, mixed mode, sharing)
  • gradle version
gradle-8.4-rc-1
  • sql-jdbc version
org.xerial:sqlite-jdbc:3.43.0.0
  • build.gradle
graalvmNative {
  binaries {
    main {
       buildArgs.addAll([
"-Dorg.sqlite.lib.exportPath=${project.layout.buildDirectory.get()}"
       ])
    }
  }
}
  • error info when native compile
[1/8] Initializing...                                                                                    (0.0s @ 0.07GB)
Error: Feature org.sqlite.nativeimage.SqliteJdbcFeature class not found on the classpath. Ensure that the name is correct and that the class is on the classpath.
com.oracle.svm.core.util.UserError$UserException: Feature org.sqlite.nativeimage.SqliteJdbcFeature class not found on the classpath. Ensure that the name is correct and that the class is on the classpath.
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.util.UserError.abort(UserError.java:73)
------------------------------------------------------------------------------------------------------------------------
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.FeatureHandler.registerFeatures(FeatureHandler.java:183)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.setupNativeImage(NativeImageGenerator.java:897)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:591)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:551)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:538)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:720)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.start(NativeImageGeneratorRunner.java:142)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:97)
                        0.2s (4.1% of total time) in 16 GCs | Peak RSS: 0.47GB | CPU load: 2.92

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 2
  • Comments: 16 (7 by maintainers)

Most upvoted comments

The fat jar approach is not “wrong” persé, but it’s prone to issues since it needs to correctly merge metadata of multiple jars, and any duplicate file occurring in more than one jar needs special care. The manifest is such a file. Your fat jar plugin simply does not correctly merge everything together, or is possibly missing configuration to tell it to handle certain files. E.g. in maven you need to specifically tell it to merge service loader resource files, by default it’ll just keep one of the duplicates at random.

Not closing this since it’s unclear if your issue was the same as the original issue of @lost22git. Also I don’t have permission to close issues 🤷

Maybe I need to invite a gradle expert @melix to help take a look at this issue