The usage of the awt
extension results in unregistered resource or reflective accesses in native mode #44622
Description
Describe the bug
As mentioned in #41995
Starting with Mandrel 23.0 (GraalVM for JDK 17) an option
-H:+ThrowMissingRegistrationErrors
was introduced to throw an exceptionwhen it is impossible to tell whether a reflective query should fail because the queried element has not been registered at build-time, or because it doesn't exist.
...
Starting with Mandrel 24.1 (GraalVM for JDK 23) the option will be available as a public flag (meaning it's no longer experimental) with the intention to ultimately become the default.
Using this flat results in exceptions being thrown when using the awt extension as described below.
Expected behavior
No unregistered resource or reflective accesses should happen.
Actual behavior
The following unregistered resource or reflective accesses happen:
com.oracle.svm.core.jdk.resources.MissingResourceRegistrationError: The program tried to access the resource bundle with name
sun.awt.resources.awt
without it being registered as reachable. Add it to the resource metadata to solve this problem. See https://www.graalvm.org/latest/reference-manual/native-image/metadata/#resources-and-resource-bundles for help
java.base@23.0.1/java.util.ResourceBundle.getBundle(ResourceBundle.java:858)
java.desktop@23.0.1/java.awt.Toolkit$4.run(Toolkit.java:1410)
java.desktop@23.0.1/java.awt.Toolkit$4.run(Toolkit.java:1407)
java.base@23.0.1/java.security.AccessController.executePrivileged(AccessController.java:132)
org.graalvm.nativeimage.MissingReflectionRegistrationError: The program tried to reflectively access class
sun.awt.resources.spi.awtProvider
without it being registered for runtime reflection. Add sun.awt.resources.spi.awtProvider to the reflection metadata to solve this problem. See https://www.graalvm.org/latest/reference-manual/native-image/metadata/#reflection for help.
java.base@23.0.1/java.util.ResourceBundle.getBundle(ResourceBundle.java:858)
java.desktop@23.0.1/java.awt.Toolkit$4.run(Toolkit.java:1410)
java.desktop@23.0.1/java.awt.Toolkit$4.run(Toolkit.java:1407)
java.base@23.0.1/java.security.AccessController.executePrivileged(AccessController.java:132)
org.graalvm.nativeimage.MissingReflectionRegistrationError: The program tried to reflectively access class
sun.awt.resources.awt
without it being registered for runtime reflection. Add sun.awt.resources.awt to the reflection metadata to solve this problem. See https://www.graalvm.org/latest/reference-manual/native-image/metadata/#reflection for help.
java.base@23.0.1/java.util.ResourceBundle.getBundle(ResourceBundle.java:858)
java.desktop@23.0.1/java.awt.Toolkit$4.run(Toolkit.java:1410)
java.desktop@23.0.1/java.awt.Toolkit$4.run(Toolkit.java:1407)
java.base@23.0.1/java.security.AccessController.executePrivileged(AccessController.java:132)
com.oracle.svm.core.jdk.resources.MissingResourceRegistrationError: The program tried to access the resource at path
sun/awt/resources/awt.properties
without it being registered as reachable. Add it to the resource metadata to solve this problem. See https://www.graalvm.org/latest/reference-manual/native-image/metadata/#resources-and-resource-bundles for help
java.base@23.0.1/java.util.ResourceBundle.getBundle(ResourceBundle.java:858)
java.desktop@23.0.1/java.awt.Toolkit$4.run(Toolkit.java:1410)
java.desktop@23.0.1/java.awt.Toolkit$4.run(Toolkit.java:1407)
java.base@23.0.1/java.security.AccessController.executePrivileged(AccessController.java:132)
org.graalvm.nativeimage.MissingReflectionRegistrationError: The program tried to reflectively access class
sun.awt.resources.awt_en
without it being registered for runtime reflection. Add sun.awt.resources.awt_en to the reflection metadata to solve this problem. See https://www.graalvm.org/latest/reference-manual/native-image/metadata/#reflection for help.
java.base@23.0.1/java.util.ResourceBundle.getBundle(ResourceBundle.java:858)
java.desktop@23.0.1/java.awt.Toolkit$4.run(Toolkit.java:1410)
java.desktop@23.0.1/java.awt.Toolkit$4.run(Toolkit.java:1407)
java.base@23.0.1/java.security.AccessController.executePrivileged(AccessController.java:132)
com.oracle.svm.core.jdk.resources.MissingResourceRegistrationError: The program tried to access the resource at path
sun/awt/resources/awt_en.properties
without it being registered as reachable. Add it to the resource metadata to solve this problem. See https://www.graalvm.org/latest/reference-manual/native-image/metadata/#resources-and-resource-bundles for help
java.base@23.0.1/java.util.ResourceBundle.getBundle(ResourceBundle.java:858)
java.desktop@23.0.1/java.awt.Toolkit$4.run(Toolkit.java:1410)
java.desktop@23.0.1/java.awt.Toolkit$4.run(Toolkit.java:1407)
java.base@23.0.1/java.security.AccessController.executePrivileged(AccessController.java:132)
org.graalvm.nativeimage.MissingReflectionRegistrationError: The program tried to reflectively access class
sun.awt.resources.awt_en_IE
without it being registered for runtime reflection. Add sun.awt.resources.awt_en_IE to the reflection metadata to solve this problem. See https://www.graalvm.org/latest/reference-manual/native-image/metadata/#reflection for help.
java.base@23.0.1/java.util.ResourceBundle.getBundle(ResourceBundle.java:858)
java.desktop@23.0.1/java.awt.Toolkit$4.run(Toolkit.java:1410)
java.desktop@23.0.1/java.awt.Toolkit$4.run(Toolkit.java:1407)
java.base@23.0.1/java.security.AccessController.executePrivileged(AccessController.java:132)
com.oracle.svm.core.jdk.resources.MissingResourceRegistrationError: The program tried to access the resource at path
sun/awt/resources/awt_en_IE.properties
without it being registered as reachable. Add it to the resource metadata to solve this problem. See https://www.graalvm.org/latest/reference-manual/native-image/metadata/#resources-and-resource-bundles for help
java.base@23.0.1/java.util.ResourceBundle.getBundle(ResourceBundle.java:858)
java.desktop@23.0.1/java.awt.Toolkit$4.run(Toolkit.java:1410)
java.desktop@23.0.1/java.awt.Toolkit$4.run(Toolkit.java:1407)
java.base@23.0.1/java.security.AccessController.executePrivileged(AccessController.java:132)
com.oracle.svm.core.jdk.resources.MissingResourceRegistrationError: The program tried to access the resource at path
META-INF/services/javax.imageio.spi.ImageInputStreamSpi
without it being registered as reachable. Add it to the resource metadata to solve this problem. See https://www.graalvm.org/latest/reference-manual/native-image/metadata/#resources-and-resource-bundles for help
java.base@23.0.1/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1387)
java.desktop@23.0.1/javax.imageio.spi.IIORegistry$1.run(IIORegistry.java:216)
java.base@23.0.1/java.security.AccessController.executePrivileged(AccessController.java:132)
java.base@23.0.1/java.security.AccessController.doPrivileged(AccessController.java:319)
com.oracle.svm.core.jdk.resources.MissingResourceRegistrationError: The program tried to access the resource at path
META-INF/services/javax.imageio.spi.ImageTranscoderSpi
without it being registered as reachable. Add it to the resource metadata to solve this problem. See https://www.graalvm.org/latest/reference-manual/native-image/metadata/#resources-and-resource-bundles for help
java.base@23.0.1/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1387)
java.desktop@23.0.1/javax.imageio.spi.IIORegistry$1.run(IIORegistry.java:216)
java.base@23.0.1/java.security.AccessController.executePrivileged(AccessController.java:132)
java.base@23.0.1/java.security.AccessController.doPrivileged(AccessController.java:319)
com.oracle.svm.core.jdk.resources.MissingResourceRegistrationError: The program tried to access the resource at path
META-INF/services/javax.imageio.spi.ImageWriterSpi
without it being registered as reachable. Add it to the resource metadata to solve this problem. See https://www.graalvm.org/latest/reference-manual/native-image/metadata/#resources-and-resource-bundles for help
java.base@23.0.1/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1387)
java.desktop@23.0.1/javax.imageio.spi.IIORegistry$1.run(IIORegistry.java:216)
java.base@23.0.1/java.security.AccessController.executePrivileged(AccessController.java:132)
java.base@23.0.1/java.security.AccessController.doPrivileged(AccessController.java:319)
com.oracle.svm.core.jdk.resources.MissingResourceRegistrationError: The program tried to access the resource at path
META-INF/services/javax.imageio.spi.ImageReaderSpi
without it being registered as reachable. Add it to the resource metadata to solve this problem. See https://www.graalvm.org/latest/reference-manual/native-image/metadata/#resources-and-resource-bundles for help
java.base@23.0.1/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1387)
java.desktop@23.0.1/javax.imageio.spi.IIORegistry$1.run(IIORegistry.java:216)
java.base@23.0.1/java.security.AccessController.executePrivileged(AccessController.java:132)
java.base@23.0.1/java.security.AccessController.doPrivileged(AccessController.java:319)
com.oracle.svm.core.jdk.resources.MissingResourceRegistrationError: The program tried to access the resource at path
META-INF/services/javax.imageio.spi.ImageOutputStreamSpi
without it being registered as reachable. Add it to the resource metadata to solve this problem. See https://www.graalvm.org/latest/reference-manual/native-image/metadata/#resources-and-resource-bundles for help
java.base@23.0.1/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1387)
java.desktop@23.0.1/javax.imageio.spi.IIORegistry$1.run(IIORegistry.java:216)
java.base@23.0.1/java.security.AccessController.executePrivileged(AccessController.java:132)
java.base@23.0.1/java.security.AccessController.doPrivileged(AccessController.java:319)
com.oracle.svm.core.jdk.resources.MissingResourceRegistrationError: The program tried to access the resource at path
META-INF/services/javax.imageio.spi.ImageInputStreamSpi
without it being registered as reachable. Add it to the resource metadata to solve this problem. See https://www.graalvm.org/latest/reference-manual/native-image/metadata/#resources-and-resource-bundles for help
java.base@23.0.1/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1387)
java.desktop@23.0.1/javax.imageio.spi.IIORegistry.registerApplicationClasspathSpis(IIORegistry.java:179)
java.desktop@23.0.1/javax.imageio.spi.IIORegistry.<init>(IIORegistry.java:107)
java.desktop@23.0.1/javax.imageio.spi.IIORegistry.getDefaultInstance(IIORegistry.java:128)
com.oracle.svm.core.jdk.resources.MissingResourceRegistrationError: The program tried to access the resource at path
META-INF/services/javax.imageio.spi.ImageTranscoderSpi
without it being registered as reachable. Add it to the resource metadata to solve this problem. See https://www.graalvm.org/latest/reference-manual/native-image/metadata/#resources-and-resource-bundles for help
java.base@23.0.1/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1387)
java.desktop@23.0.1/javax.imageio.spi.IIORegistry.registerApplicationClasspathSpis(IIORegistry.java:179)
java.desktop@23.0.1/javax.imageio.spi.IIORegistry.<init>(IIORegistry.java:107)
java.desktop@23.0.1/javax.imageio.spi.IIORegistry.getDefaultInstance(IIORegistry.java:128)
com.oracle.svm.core.jdk.resources.MissingResourceRegistrationError: The program tried to access the resource at path
META-INF/services/javax.imageio.spi.ImageWriterSpi
without it being registered as reachable. Add it to the resource metadata to solve this problem. See https://www.graalvm.org/latest/reference-manual/native-image/metadata/#resources-and-resource-bundles for help
java.base@23.0.1/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1387)
java.desktop@23.0.1/javax.imageio.spi.IIORegistry.registerApplicationClasspathSpis(IIORegistry.java:179)
java.desktop@23.0.1/javax.imageio.spi.IIORegistry.<init>(IIORegistry.java:107)
java.desktop@23.0.1/javax.imageio.spi.IIORegistry.getDefaultInstance(IIORegistry.java:128)
com.oracle.svm.core.jdk.resources.MissingResourceRegistrationError: The program tried to access the resource at path
META-INF/services/javax.imageio.spi.ImageReaderSpi
without it being registered as reachable. Add it to the resource metadata to solve this problem. See https://www.graalvm.org/latest/reference-manual/native-image/metadata/#resources-and-resource-bundles for help
java.base@23.0.1/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1387)
java.desktop@23.0.1/javax.imageio.spi.IIORegistry.registerApplicationClasspathSpis(IIORegistry.java:179)
java.desktop@23.0.1/javax.imageio.spi.IIORegistry.<init>(IIORegistry.java:107)
java.desktop@23.0.1/javax.imageio.spi.IIORegistry.getDefaultInstance(IIORegistry.java:128)
com.oracle.svm.core.jdk.resources.MissingResourceRegistrationError: The program tried to access the resource at path
META-INF/services/javax.imageio.spi.ImageOutputStreamSpi
without it being registered as reachable. Add it to the resource metadata to solve this problem. See https://www.graalvm.org/latest/reference-manual/native-image/metadata/#resources-and-resource-bundles for help
java.base@23.0.1/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1387)
java.desktop@23.0.1/javax.imageio.spi.IIORegistry.registerApplicationClasspathSpis(IIORegistry.java:179)
java.desktop@23.0.1/javax.imageio.spi.IIORegistry.<init>(IIORegistry.java:107)
java.desktop@23.0.1/javax.imageio.spi.IIORegistry.getDefaultInstance(IIORegistry.java:128)
How to Reproduce?
./mvnw clean package -Dnative -Dnative.surefire.skip \
-Dquarkus.native.builder-image=quay.io/quarkus/ubi-quarkus-mandrel-builder-image:jdk-23 \
-Dquarkus.native.enable-reports -pl integration-tests/awt/ \
-Dquarkus.native.additional-build-args=-H:ThrowMissingRegistrationErrors=
./integration-tests/awt/target/quarkus-integration-test-awt-999-SNAPSHOT-runner -XX:MissingRegistrationReportingMode=Warn
Tip
In GraalVM for JDK 24 the length of the printed stack trace when using -XX:MissingRegistrationReportingMode=Warn
can be set with -XX:MissingRegistrationWarnContextLines=
Output of uname -a
or ver
No response
Output of java -version
No response
Mandrel or GraalVM version (if different from Java)
No response
Quarkus version or git rev
No response
Build tool (ie. output of mvnw --version
or gradlew --version
)
No response
Additional information
No response