Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when compiling Spring Native image which depends on snowflake-jdbc #1222

Closed
bnorm opened this issue Jan 13, 2023 · 5 comments
Closed
Assignees
Labels
question Issue is a usage/other question rather than a bug status-triage_done Initial triage done, will be further handled by the driver team

Comments

@bnorm
Copy link

bnorm commented Jan 13, 2023

I'm testing out GraalVM native images and hitting an error during compilation pointing at class net.snowflake.client.jdbc.internal.google.api.gax.nativeimage.GoogleJsonClientFeature.

...
Warning: Feature class net.snowflake.client.jdbc.internal.google.api.gax.nativeimage.OpenCensusFeature is annotated with the deprecated annotation @AutomaticFeature. Support for this annotation will be removed in a future version of GraalVM. Applications should register a feature using the option --features=net.snowflake.client.jdbc.internal.google.api.gax.nativeimage.OpenCensusFeature
Warning: Feature class net.snowflake.client.jdbc.internal.google.api.gax.nativeimage.GoogleJsonClientFeature is annotated with the deprecated annotation @AutomaticFeature. Support for this annotation will be removed in a future version of GraalVM. Applications should register a feature using the option --features=net.snowflake.client.jdbc.internal.google.api.gax.nativeimage.GoogleJsonClientFeature
...
Fatal error: java.lang.IllegalAccessError: class net.snowflake.client.jdbc.internal.google.api.gax.nativeimage.GoogleJsonClientFeature (in unnamed module @0x5b65c6fd) cannot access class com.oracle.svm.core.configure.ResourcesRegistry (in module org.graalvm.nativeimage.builder) because module org.graalvm.nativeimage.builder does not export com.oracle.svm.core.configure to unnamed module @0x5b65c6fd
	at net.snowflake.client.jdbc.internal.google.api.gax.nativeimage.GoogleJsonClientFeature.loadApiClient(GoogleJsonClientFeature.java:76)
	at net.snowflake.client.jdbc.internal.google.api.gax.nativeimage.GoogleJsonClientFeature.beforeAnalysis(GoogleJsonClientFeature.java:55)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$9(NativeImageGenerator.java:736)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:85)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:736)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:578)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:535)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:403)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:580)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:128)

This seems to be included through google-cloud-storage -> gax-java. It also looks like newer versions of gax-java might have fixed this issue. Would it be possible to update the version of google-cloud-storage used to pull in the most recent version of gax-java?

@matthenry87
Copy link

matthenry87 commented Jan 16, 2023

I also just ran into this error.

Spring Boot 3.0.1

Version info: 'GraalVM 22.3.0 Java 17 CE'
Java version info: '17.0.5+8-LTS'
C compiler: gcc (linux, x86_64, 7.5.0)
Garbage collector: Serial GC

<dependency>
    <groupId>net.snowflake</groupId>
    <artifactId>snowflake-jdbc</artifactId>
    <version>3.13.26</version>
</dependency>

@sfc-gh-igarish sfc-gh-igarish added the question Issue is a usage/other question rather than a bug label Feb 21, 2023
@sfc-gh-igarish
Copy link
Collaborator

The JDBC driver uses this version of google-cloud-storage:
com.google.cloud
google-cloud-storage
2.6.2

Which version you think has the fix? The actual error comes from "cannot access class com.oracle.svm.core.configure.ResourcesRegistry (in module org.graalvm.nativeimage.builder) because module org.graalvm.nativeimage.builder does not export com.oracle.svm.core.configure to unnamed module @0x5b65c6fd
at net.snowflake.client.jdbc.internal.google.api.gax.nativeimage.GoogleJsonClientFeature.loadApiClient(GoogleJsonClientFeature.java:76)". Note that JDBC driver is not build as module. So do you think it's a module issue or version issue?

@matthenry87
Copy link

It looks to me that net.snowflake.client.jdbc.internal.google.api.gax.nativeimage.GoogleJsonClientFeature lives in the SnowFlake JDBC driver:

image

And, it's attempting to use a class that has been encapsulated, perhaps in newer versions of GraalVM?:

image

But from what I see the issue is within the SnowFlake JDBC driver. I think what should happen is that these resource hints should be provided via GraalVM metadata JSON files, instead of being added programmatically inside of this GraalVM Feature implementation.

@bnorm
Copy link
Author

bnorm commented Mar 16, 2023

It looks to me that net.snowflake.client.jdbc.internal.google.api.gax.nativeimage.GoogleJsonClientFeature lives in the SnowFlake JDBC driver:

With a package like that, I would guess that the Snowflake JDBC is shadowing the library to avoid version conflicts.

So do you think it's a module issue or version issue?

Sort of both? But the SVM dependency - which is what ResourcesRegistry is from - was entirely removed from gax in version v2.18.0 so it doesn't really matter.

Which version you think has the fix?

The latest version of google-cloud-storage is v2.20.1. v2.7.0 is the first to bring in v2.18.1 of gax so that is the minimum to fix this issue. That version does have known vulnerabilities though so I would recommend upgrading to at least v2.13.1 if you cannot upgrade to the latest.

@sfc-gh-dszmolka
Copy link
Contributor

currently gax is at 2.31.0 so closing this issue for now, but do comment please if further help is needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Issue is a usage/other question rather than a bug status-triage_done Initial triage done, will be further handled by the driver team
Projects
None yet
Development

No branches or pull requests

7 participants