graalvm/native-build-tools

./gradlew -Pagent run fails with Error: could not open `C:\Program Files\Java\graalvm-jdk-21.0.2+13.1\lib\svm\bin\.native-image-configure.exports'

sku0x20 opened this issue · 2 comments

following https://graalvm.github.io/native-build-tools/latest/gradle-plugin-quickstart.html on windows 11

./gradlew -Pagent run
> Task :run
[native-image-plugin] Instrumenting task with the native-image-agent: run
[0.128s][warning][jni,resolve] Re-registering of platform native method: jdk.internal.misc.Unsafe.allocateInstance(Ljava/lang/Class;)Ljava/lang/Object; from code in a different classloader
Warning: Error processing trace entry map(size=5, {(tracer,reflect),(function,getSystemResource),(caller_class,java.lang.ClassLoader),(result,true),(args,[null])}): java.lang.NullPointerException
        at java.base@21.0.2/java.util.regex.Pattern.quote(Pattern.java:1499)
        at org.graalvm.nativeimage.configure/com.oracle.svm.configure.trace.ReflectionProcessor.processEntry(ReflectionProcessor.java:85)
        at org.graalvm.nativeimage.configure/com.oracle.svm.configure.trace.TraceProcessor.processEntry(TraceProcessor.java:88)
        at org.graalvm.nativeimage.agent.tracing/com.oracle.svm.agent.tracing.ConfigurationResultWriter.traceEntry(ConfigurationResultWriter.java:53)
        at org.graalvm.nativeimage.agent.tracing/com.oracle.svm.agent.tracing.core.Tracer.traceCall(Tracer.java:117)
        at org.graalvm.nativeimage.agent.tracing/com.oracle.svm.agent.BreakpointInterceptor.traceBreakpoint(BreakpointInterceptor.java:187)
        at org.graalvm.nativeimage.agent.tracing/com.oracle.svm.agent.BreakpointInterceptor.traceReflectBreakpoint(BreakpointInterceptor.java:176)
        at org.graalvm.nativeimage.agent.tracing/com.oracle.svm.agent.BreakpointInterceptor.handleGetSystemResources(BreakpointInterceptor.java:619)
        at org.graalvm.nativeimage.agent.tracing/com.oracle.svm.agent.BreakpointInterceptor.getSystemResource(BreakpointInterceptor.java:609)
        at org.graalvm.nativeimage.agent.tracing/com.oracle.svm.agent.BreakpointInterceptor.onBreakpoint(BreakpointInterceptor.java:1112)

Mass man must be serviced by mass means.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Error: could not open `C:\Program Files\Java\graalvm-jdk-21.0.2+13.1\lib\svm\bin\.native-image-configure.exports'

> Task :run FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':run'.
> Process 'command 'C:\Program Files\Java\graalvm-jdk-21.0.2+13.1\bin\native-image-configure.cmd'' finished with non-zero exit value 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 6s
4 actionable tasks: 2 executed, 2 up-to-date

metadata files are getting generated even thought it failed but on metadataCopy fails with same error.

./gradlew metadataCopy --task run --dir src/main/resources/META-INF/native-image

> Task :metadataCopy FAILED
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Access is denied.
Error: could not open `C:\Program Files\Java\graalvm-jdk-21.0.2+13.1\lib\svm\bin\.native-image-configure.exports'

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':metadataCopy'.
> Process 'command 'C:\Program Files\Java\graalvm-jdk-21.0.2+13.1\bin\native-image-configure.cmd'' finished with non-zero exit value 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 1s
1 actionable task: 1 executed

System Info:

  • OS: Windows 11
java 21.0.2 2024-01-16 LTS
Java(TM) SE Runtime Environment Oracle GraalVM 21.0.2+13.1 (build 21.0.2+13-LTS-jvmci-23.1-b30)
Java HotSpot(TM) 64-Bit Server VM Oracle GraalVM 21.0.2+13.1 (build 21.0.2+13-LTS-jvmci-23.1-b30, mixed mode, sharing)
  • Plugin version: id("org.graalvm.buildtools.native") version "0.10.1"

Same problem. The good thing, that configuration is actually created, so you can copy it manually and the rest is working then. But it is still annoying.

This is a GraalVM issue (opened here). As a workaround, one can use a GraalVM distribution that is not installed into a write protected folder.

Closing the ticket as it will be resolved in GraalVM.