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

IllegalAccessError when using gradle nativeCompile #1268

Closed
andreldsr opened this issue Apr 24, 2023 · 9 comments
Closed

IllegalAccessError when using gradle nativeCompile #1268

andreldsr opened this issue Apr 24, 2023 · 9 comments
Assignees
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@andreldsr
Copy link

Bug Description

While trying to build a spring boot 3 project with kotlin and gradle with a connection to Postgres SQL on GCP i receive this error

Fatal error: java.lang.IllegalAccessError: class com.google.cloud.sql.nativeimage.CloudSqlFeature (in unnamed module @0x5831989d) 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 @0x5831989d
        at com.google.cloud.sql.nativeimage.CloudSqlFeature.beforeAnalysis(CloudSqlFeature.java:55)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$9(NativeImageGenerator.java:722)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:78)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:722)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:564)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:521)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:407)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:585)

Example code (or command)

id("org.graalvm.buildtools.native") version "0.9.20"
implementation("com.google.cloud.sql:postgres-socket-factory:1.11.1")

Stacktrace

No response

Steps to reproduce?

The project runs and connects normally but when I run ./gradlew nativeCompile it crashes

Environment

Kotlin: 1.7.10
Groovy: 3.0.13
Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM: 17.0.4 (GraalVM Community 17.0.4+8-jvmci-22.2-b06)
OS: Linux 5.14.0-1054-oem amd64

Additional Details

No response

@andreldsr andreldsr added the type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. label Apr 24, 2023
@enocom enocom added the priority: p2 Moderately-important priority. Fix may not be included in next release. label Apr 24, 2023
@enocom
Copy link
Member

enocom commented Apr 24, 2023

Thanks for the report @andreldsr. I'm a bit surprised to hear this as we shipped GraalVM support awhile ago. I'll look into it.

@enocom
Copy link
Member

enocom commented Apr 24, 2023

Related: oracle/graal#3803.

@enocom
Copy link
Member

enocom commented Apr 24, 2023

@andreldsr Have you tried this on a more recent version of the GraalVM (e.g. 22.3)?

@andreldsr
Copy link
Author

Actually I've started using this enviroment

Kotlin: 1.7.10
Groovy: 3.0.13
Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM: 17.0.5 (GraalVM Community 17.0.5+8-jvmci-22.3-b08)
OS: Linux 5.14.0-1054-oem amd64

I can run the ./gradlew bootBuildImage but cant run the ./gradlew nativeCompile

@andreldsr
Copy link
Author

Here is the repository, if you'd like to look for any misconfiguration or something like that
https://github.com/andreldsr/cartinhas

@enocom
Copy link
Member

enocom commented Apr 24, 2023

Thanks for the reproduction. I'll take a look.

@enocom
Copy link
Member

enocom commented Apr 25, 2023

If I comment out this line in your build.gradle.kts, the native compilation works:

mavenBom("com.google.cloud:spring-cloud-gcp-dependencies:$springCloudGcpVersion")

Meanwhile, if I build a minimal Spring app with the Socket Factory, I also get no compilation error. This seems to be some kind of conflict with the dependency above.

@andreldsr
Copy link
Author

It really seems like just misconfiguration from my part, thanks for your help. I was just following some tutorials about it and found this bug.

@enocom
Copy link
Member

enocom commented Apr 25, 2023

Feel free to re-open with more information if you think there’s a problem here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

2 participants