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: java.util.concurrent.ExecutionException: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: type is not available in this platform: com.oracle.svm.hosted.NativeImageSystemClassLoader #8883

Closed
anshu-zs opened this issue May 7, 2024 · 7 comments
Assignees

Comments

@anshu-zs
Copy link

anshu-zs commented May 7, 2024

Hi,
I am facing this issue while creating native image

Error: java.util.concurrent.ExecutionException: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: type is not available in this platform: com.oracle.svm.hosted.NativeImageSystemClassLoader
Error: Use -H:+ReportExceptionStackTraces to print stacktrace of underlying exception
Error: java.util.concurrent.ExecutionException: org.graalvm.compiler.debug.GraalError: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: type is not available in this platform: com.oracle.svm.hosted.NativeImageSystemClassLoader
Error: Use -H:+ReportExceptionStackTraces to print stacktrace of underlying exception

Here is the complete build output

tUnsupportedElementsAtRuntime   -H:Class=examples.http.Main  -jar rocket-examples-0.31.0.jar
========================================================================================================================
GraalVM Native Image: Generating 'rocket-examples-0.31.0' (executable)...
========================================================================================================================
02:40:22,827 |-INFO in ch.qos.logback.classic.LoggerContext[default] - This is logback-classic version ?
02:40:22,827 |-INFO in ch.qos.logback.classic.util.ContextInitializer@57a5b03 - No custom configurators were discovered as a service.
02:40:22,827 |-INFO in ch.qos.logback.classic.util.ContextInitializer@57a5b03 - Trying to configure with ch.qos.logback.classic.joran.SerializedModelConfigurator
02:40:22,827 |-INFO in ch.qos.logback.classic.util.ContextInitializer@57a5b03 - Constructed configurator of type class ch.qos.logback.classic.joran.SerializedModelConfigurator
02:40:22,828 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.scmo]
02:40:22,828 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.scmo]
02:40:22,831 |-INFO in ch.qos.logback.classic.util.ContextInitializer@57a5b03 - ch.qos.logback.classic.joran.SerializedModelConfigurator.configure() call lasted 1 milliseconds. ExecutionStatus=INVOKE_NEXT_IF_ANY
02:40:22,831 |-INFO in ch.qos.logback.classic.util.ContextInitializer@57a5b03 - Trying to configure with ch.qos.logback.classic.util.DefaultJoranConfigurator
02:40:22,831 |-INFO in ch.qos.logback.classic.util.ContextInitializer@57a5b03 - Constructed configurator of type class ch.qos.logback.classic.util.DefaultJoranConfigurator
02:40:22,831 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
02:40:22,832 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [jar:file:/Users/raramuri/Desktop/Anshu/rocket/rocket-examples/build/libs/rocket-examples-0.31.0.jar!/logback.xml]
02:40:22,832 |-INFO in ch.qos.logback.core.joran.spi.ConfigurationWatchList@5649f55 - URL [jar:file:/Users/raramuri/Desktop/Anshu/rocket/rocket-examples/build/libs/rocket-examples-0.31.0.jar!/logback.xml] is not of type file
02:40:22,861 |-INFO in ch.qos.logback.core.joran.action.ConversionRuleAction - registering conversion word colorize with class [org.tuxdude.logback.extensions.LogColorizer]
02:40:22,873 |-INFO in ch.qos.logback.classic.model.processor.LoggerModelHandler - Setting level of logger [io] to OFF
02:40:22,873 |-INFO in ch.qos.logback.classic.model.processor.LoggerModelHandler - Setting level of logger [org] to OFF
02:40:22,873 |-INFO in ch.qos.logback.classic.model.processor.LoggerModelHandler - Setting level of logger [com.zaxxer] to OFF
02:40:22,873 |-INFO in ch.qos.logback.classic.model.processor.LoggerModelHandler - Setting level of logger [com.datastax] to OFF
02:40:22,873 |-INFO in ch.qos.logback.classic.model.processor.LoggerModelHandler - Setting level of logger [net] to OFF
02:40:22,873 |-INFO in ch.qos.logback.classic.model.processor.LoggerModelHandler - Setting level of logger [io.lettuce] to OFF
02:40:22,873 |-INFO in ch.qos.logback.classic.model.processor.LoggerModelHandler - Setting level of logger [reactor.util] to OFF
02:40:22,873 |-INFO in ch.qos.logback.classic.model.processor.LoggerModelHandler - Setting level of logger [reactor.core] to OFF
02:40:22,873 |-INFO in ch.qos.logback.classic.model.processor.LoggerModelHandler - Setting level of logger [reactor] to OFF
02:40:22,873 |-INFO in ch.qos.logback.classic.model.processor.LoggerModelHandler - Setting level of logger [com.azure] to OFF
02:40:22,873 |-INFO in ch.qos.logback.classic.model.processor.LoggerModelHandler - Setting level of logger [reactor.netty] to OFF
02:40:22,873 |-INFO in ch.qos.logback.classic.model.processor.LoggerModelHandler - Setting level of logger [software.amazon.awssdk] to OFF
02:40:22,873 |-INFO in ch.qos.logback.classic.model.processor.LoggerModelHandler - Setting level of logger [com.amazonaws] to OFF
02:40:22,873 |-INFO in ch.qos.logback.core.model.processor.AppenderModelHandler - Processing appender named [STDOUT]
02:40:22,873 |-INFO in ch.qos.logback.core.model.processor.AppenderModelHandler - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
02:40:22,875 |-INFO in ch.qos.logback.classic.model.processor.RootLoggerModelHandler - Setting level of ROOT logger to TRACE
02:40:22,875 |-INFO in ch.qos.logback.core.model.processor.AppenderRefModelHandler - Attaching appender named [STDOUT] to Logger[ROOT]
02:40:22,876 |-INFO in ch.qos.logback.core.model.processor.DefaultProcessor@56da8847 - End of configuration.
02:40:22,876 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@2c02a007 - Registering current configuration as safe fallback point
02:40:22,876 |-INFO in ch.qos.logback.classic.util.ContextInitializer@57a5b03 - ch.qos.logback.classic.util.DefaultJoranConfigurator.configure() call lasted 45 milliseconds. ExecutionStatus=DO_NOT_INVOKE_NEXT_IF_ANY
Warning: Could not register io.netty.handler.codec.compression.Lz4FrameDecoder: queryAllPublicMethods for reflection. Reason: java.lang.NoClassDefFoundError: net/jpountz/lz4/LZ4Exception.
Warning: Could not register io.netty.handler.codec.compression.Lz4FrameEncoder: queryAllPublicMethods for reflection. Reason: java.lang.NoClassDefFoundError: net/jpountz/lz4/LZ4Exception.
Warning: Could not register io.netty.handler.codec.marshalling.CompatibleMarshallingDecoder: queryAllPublicMethods for reflection. Reason: java.lang.NoClassDefFoundError: org/jboss/marshalling/ByteInput.
Warning: Could not register io.netty.handler.codec.marshalling.CompatibleMarshallingEncoder: queryAllPublicMethods for reflection. Reason: java.lang.NoClassDefFoundError: org/jboss/marshalling/ByteOutput.
Warning: Could not register io.netty.handler.codec.marshalling.MarshallingDecoder: queryAllPublicMethods for reflection. Reason: java.lang.NoClassDefFoundError: org/jboss/marshalling/ByteInput.
Warning: Could not register io.netty.handler.codec.marshalling.MarshallingEncoder: queryAllPublicMethods for reflection. Reason: java.lang.NoClassDefFoundError: org/jboss/marshalling/ByteOutput.
Warning: Could not register io.netty.handler.codec.compression.Lz4FrameDecoder: queryAllPublicMethods for reflection. Reason: java.lang.NoClassDefFoundError: net/jpountz/lz4/LZ4Exception.
Warning: Could not register io.netty.handler.codec.compression.Lz4FrameEncoder: queryAllPublicMethods for reflection. Reason: java.lang.NoClassDefFoundError: net/jpountz/lz4/LZ4Exception.
Warning: Could not register io.netty.handler.codec.marshalling.CompatibleMarshallingDecoder: queryAllPublicMethods for reflection. Reason: java.lang.NoClassDefFoundError: org/jboss/marshalling/ByteInput.
Warning: Could not register io.netty.handler.codec.marshalling.CompatibleMarshallingEncoder: queryAllPublicMethods for reflection. Reason: java.lang.NoClassDefFoundError: org/jboss/marshalling/ByteOutput.
Warning: Could not register io.netty.handler.codec.marshalling.MarshallingDecoder: queryAllPublicMethods for reflection. Reason: java.lang.NoClassDefFoundError: org/jboss/marshalling/ByteInput.
Warning: Could not register io.netty.handler.codec.marshalling.MarshallingEncoder: queryAllPublicMethods for reflection. Reason: java.lang.NoClassDefFoundError: org/jboss/marshalling/ByteOutput.
Warning: Could not register io.grpc.netty.shaded.io.netty.handler.codec.compression.Lz4FrameDecoder: queryAllPublicMethods for reflection. Reason: java.lang.NoClassDefFoundError: net/jpountz/lz4/LZ4Exception.
Warning: Could not register io.grpc.netty.shaded.io.netty.handler.codec.compression.Lz4FrameEncoder: queryAllPublicMethods for reflection. Reason: java.lang.NoClassDefFoundError: net/jpountz/lz4/LZ4Exception.
Warning: Could not register io.grpc.netty.shaded.io.netty.handler.codec.marshalling.CompatibleMarshallingDecoder: queryAllPublicMethods for reflection. Reason: java.lang.NoClassDefFoundError: org/jboss/marshalling/ByteInput.
Warning: Could not register io.grpc.netty.shaded.io.netty.handler.codec.marshalling.CompatibleMarshallingEncoder: queryAllPublicMethods for reflection. Reason: java.lang.NoClassDefFoundError: org/jboss/marshalling/ByteOutput.
Warning: Could not register io.grpc.netty.shaded.io.netty.handler.codec.marshalling.MarshallingDecoder: queryAllPublicMethods for reflection. Reason: java.lang.NoClassDefFoundError: org/jboss/marshalling/ByteInput.
Warning: Could not register io.grpc.netty.shaded.io.netty.handler.codec.marshalling.MarshallingEncoder: queryAllPublicMethods for reflection. Reason: java.lang.NoClassDefFoundError: org/jboss/marshalling/ByteOutput.
Warning: Could not register io.grpc.netty.shaded.io.netty.handler.codec.compression.Lz4FrameDecoder: queryAllPublicMethods for reflection. Reason: java.lang.NoClassDefFoundError: net/jpountz/lz4/LZ4Exception.
Warning: Could not register io.grpc.netty.shaded.io.netty.handler.codec.compression.Lz4FrameEncoder: queryAllPublicMethods for reflection. Reason: java.lang.NoClassDefFoundError: net/jpountz/lz4/LZ4Exception.
Warning: Could not register io.grpc.netty.shaded.io.netty.handler.codec.marshalling.CompatibleMarshallingDecoder: queryAllPublicMethods for reflection. Reason: java.lang.NoClassDefFoundError: org/jboss/marshalling/ByteInput.
Warning: Could not register io.grpc.netty.shaded.io.netty.handler.codec.marshalling.CompatibleMarshallingEncoder: queryAllPublicMethods for reflection. Reason: java.lang.NoClassDefFoundError: org/jboss/marshalling/ByteOutput.
Warning: Could not register io.grpc.netty.shaded.io.netty.handler.codec.marshalling.MarshallingDecoder: queryAllPublicMethods for reflection. Reason: java.lang.NoClassDefFoundError: org/jboss/marshalling/ByteInput.
Warning: Could not register io.grpc.netty.shaded.io.netty.handler.codec.marshalling.MarshallingEncoder: queryAllPublicMethods for reflection. Reason: java.lang.NoClassDefFoundError: org/jboss/marshalling/ByteOutput.
Warning: Could not resolve com.google.auth.appengine.AppEngineCredentials for reflection configuration. Reason: java.lang.ClassNotFoundException: com.google.auth.appengine.AppEngineCredentials.
Warning: Could not resolve org.apache.commons.pool2.impl.DefaultEvictionPolicy for reflection configuration. Reason: java.lang.ClassNotFoundException: org.apache.commons.pool2.impl.DefaultEvictionPolicy.
Warning: Could not resolve ccom.zopsmart.rocket.rlog.SystemData for reflection configuration. Reason: java.lang.ClassNotFoundException: ccom.zopsmart.rocket.rlog.SystemData.
Warning: Method ch.qos.logback.core.Layout.valueOf(String) not found.
Warning: Method ch.qos.logback.core.encoder.Encoder.valueOf(String) not found.
Warning: Method ch.qos.logback.core.spi.ContextAware.valueOf(String) not found.
Warning: Could not resolve com.sun.crypto.provider.GaloisCounterMode$AESGCM for reflection configuration. Reason: java.lang.ClassNotFoundException: com.sun.crypto.provider.GaloisCounterMode$AESGCM.
Warning: Could not resolve com.zopsmart.rocket,com.zopsmart.rocket.logger.JsonFormatter for reflection configuration. Reason: java.lang.ClassNotFoundException: com.zopsmart.rocket,com.zopsmart.rocket.logger.JsonFormatter.
Warning: Could not resolve com.zopsmart.rocket.oauth. for reflection configuration. Reason: java.lang.ClassNotFoundException: com.zopsmart.rocket.oauth..
Warning: Could not resolve com.zopsmart.rocket.ros.entity.ConfigEntity for reflection configuration. Reason: java.lang.ClassNotFoundException: com.zopsmart.rocket.ros.entity.ConfigEntity.
Warning: Could not resolve io.grpc.netty.shaded.io.netty.channel.ProtocolNegotiators for reflection configuration. Reason: java.lang.ClassNotFoundException: io.grpc.netty.shaded.io.netty.channel.ProtocolNegotiators.
Warning: Could not resolve io.undertow.UndertowLogger_$logger_en for reflection configuration. Reason: java.lang.ClassNotFoundException: io.undertow.UndertowLogger_$logger_en.
Warning: Could not resolve io.undertow.UndertowLogger_$logger_en_IN for reflection configuration. Reason: java.lang.ClassNotFoundException: io.undertow.UndertowLogger_$logger_en_IN.
Warning: Method java.io.InputStream.skipNBytes(long) not found.
Warning: Field java.lang.String.TYPE not found.
Warning: Could not resolve java.lang.constant.Constable for reflection configuration. Reason: java.lang.ClassNotFoundException: java.lang.constant.Constable.
Warning: Could not resolve java.lang.invoke.TypeDescriptor for reflection configuration. Reason: java.lang.ClassNotFoundException: java.lang.invoke.TypeDescriptor.
Warning: Could not resolve java.lang.invoke.TypeDescriptor$OfField for reflection configuration. Reason: java.lang.ClassNotFoundException: java.lang.invoke.TypeDescriptor$OfField.
Warning: Method java.nio.DirectByteBuffer.<init>(long, long) not found.
Warning: Could not resolve javafx.beans.value.ObservableValue for reflection configuration. Reason: java.lang.ClassNotFoundException: javafx.beans.value.ObservableValue.
Warning: Method javax.management.StandardEmitterMBean.cacheMBeanInfo(MBeanInfo) not found.
Warning: Method javax.management.StandardEmitterMBean.getCachedMBeanInfo() not found.
Warning: Method javax.management.StandardEmitterMBean.getMBeanInfo() not found.
Warning: Could not resolve javax.management.remote.rmi.RMIServerImpl_Skel for reflection configuration. Reason: java.lang.ClassNotFoundException: javax.management.remote.rmi.RMIServerImpl_Skel.
Warning: Could not resolve javax.money.MonetaryAmount for reflection configuration. Reason: java.lang.ClassNotFoundException: javax.money.MonetaryAmount.
Warning: Method jdk.management.jfr.FlightRecorderMXBeanImpl.cacheMBeanInfo(MBeanInfo) not found.
Warning: Method jdk.management.jfr.FlightRecorderMXBeanImpl.getCachedMBeanInfo() not found.
Warning: Method jdk.management.jfr.FlightRecorderMXBeanImpl.getMBeanInfo() not found.
Warning: Method jdk.management.jfr.FlightRecorderMXBeanImpl.getNotificationInfo() not found.
Warning: Unknown attribute(s) [allSigners, allRecordComponents, allNestMembers] in reflection class descriptor object
Warning: Could not resolve nonapi.io.github.classgraph.ClassGraph for reflection configuration. Reason: java.lang.ClassNotFoundException: nonapi.io.github.classgraph.ClassGraph.
Warning: Could not resolve nonapi.io.github.classgraph.classloaderhandler for reflection configuration. Reason: java.lang.ClassNotFoundException: nonapi.io.github.classgraph.classloaderhandler.
Warning: Could not resolve org.apache.log4j.LogManager for reflection configuration. Reason: java.lang.ClassNotFoundException: org.apache.log4j.LogManager.
Warning: Could not resolve org.apache.logging.log4j.Logger for reflection configuration. Reason: java.lang.ClassNotFoundException: org.apache.logging.log4j.Logger.
Warning: Could not resolve org.hibernate.validator.internal.util.logging.Log_$logger_en for reflection configuration. Reason: java.lang.ClassNotFoundException: org.hibernate.validator.internal.util.logging.Log_$logger_en.
Warning: Could not resolve org.hibernate.validator.internal.util.logging.Log_$logger_en_IN for reflection configuration. Reason: java.lang.ClassNotFoundException: org.hibernate.validator.internal.util.logging.Log_$logger_en_IN.
Warning: Could not resolve org.hibernate.validator.internal.util.logging.Messages_$bundle_en for reflection configuration. Reason: java.lang.ClassNotFoundException: org.hibernate.validator.internal.util.logging.Messages_$bundle_en.
Warning: Could not resolve org.hibernate.validator.internal.util.logging.Messages_$bundle_en_IN for reflection configuration. Reason: java.lang.ClassNotFoundException: org.hibernate.validator.internal.util.logging.Messages_$bundle_en_IN.
Warning: Could not resolve org.jboss.logmanager.LogManager for reflection configuration. Reason: java.lang.ClassNotFoundException: org.jboss.logmanager.LogManager.
Warning: Could not resolve org.jboss.threads.Messages_$logger_en for reflection configuration. Reason: java.lang.ClassNotFoundException: org.jboss.threads.Messages_$logger_en.
Warning: Could not resolve org.jboss.threads.Messages_$logger_en_IN for reflection configuration. Reason: java.lang.ClassNotFoundException: org.jboss.threads.Messages_$logger_en_IN.
Warning: Could not resolve org.joda.time.ReadableInstant for reflection configuration. Reason: java.lang.ClassNotFoundException: org.joda.time.ReadableInstant.
Warning: Could not resolve org.xnio._private.Messages_$logger_en for reflection configuration. Reason: java.lang.ClassNotFoundException: org.xnio._private.Messages_$logger_en.
Warning: Could not resolve org.xnio._private.Messages_$logger_en_IN for reflection configuration. Reason: java.lang.ClassNotFoundException: org.xnio._private.Messages_$logger_en_IN.
Warning: Could not resolve org.xnio.nio.Log_$logger_en for reflection configuration. Reason: java.lang.ClassNotFoundException: org.xnio.nio.Log_$logger_en.
Warning: Could not resolve org.xnio.nio.Log_$logger_en_IN for reflection configuration. Reason: java.lang.ClassNotFoundException: org.xnio.nio.Log_$logger_en_IN.
Warning: Method sun.security.provider.NativePRNG.<init>(SecureRandomParameters) not found.
[1/7] Initializing...                                                                                   (12.2s @ 0.69GB)
 Version info: 'GraalVM 22.3.1 Java 11 CE'
 Java version info: '11.0.18+10-jvmci-22.3-b13'
 C compiler: cc (apple, arm64, 15.0.0)
 Garbage collector: Serial GC
 4 user-specific feature(s)
 - com.google.api.gax.grpc.nativeimage.GrpcNettyFeature
 - com.google.api.gax.nativeimage.GoogleJsonClientFeature
 - com.google.api.gax.nativeimage.OpenCensusFeature
 - com.oracle.svm.thirdparty.gson.GsonFeature
Mar 12, 2024 2:40:28 AM com.google.api.gax.nativeimage.NativeImageUtils registerClassForReflection
WARNING: Failed to find io.grpc.netty.shaded.io.netty.channel.ProtocolNegotiators on the classpath for reflection.
[2/7] Performing analysis...  [WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by io.netty.util.internal.ReflectionUtil (file:/Users/raramuri/Desktop/Anshu/rocket/rocket-examples/build/libs/rocket-examples-0.31.0.jar) to constructor java.nio.DirectByteBuffer(long,int)
WARNING: Please consider reporting this to the maintainers of io.netty.util.internal.ReflectionUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
*]                                                                       (55.8s @ 1.83GB)
  10,881 (82.43%) of 13,200 classes reachable
  18,182 (64.59%) of 28,148 fields reachable
  53,011 (51.23%) of 103,475 methods reachable
   1,164 classes, 3,276 fields, and 19,921 methods registered for reflection
       1 native library: -framework CoreServices

Error: java.util.concurrent.ExecutionException: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: type is not available in this platform: com.oracle.svm.hosted.NativeImageSystemClassLoader
Error: Use -H:+ReportExceptionStackTraces to print stacktrace of underlying exception
Error: java.util.concurrent.ExecutionException: org.graalvm.compiler.debug.GraalError: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: type is not available in this platform: com.oracle.svm.hosted.NativeImageSystemClassLoader
Error: Use -H:+ReportExceptionStackTraces to print stacktrace of underlying exception
------------------------------------------------------------------------------------------------------------------------
                       16.6s (24.2% of total time) in 55 GCs | Peak RSS: 2.36GB | CPU load: 4.10
========================================================================================================================
Failed generating 'rocket-examples-0.31.0' after 1m 8s.
Error: Image build request failed with exit status 1

GraalVM and your environment:
openjdk 11.0.18 2023-01-17
OpenJDK Runtime Environment GraalVM CE 22.3.1 (build 11.0.18+10-jvmci-22.3-b13)
OpenJDK 64-Bit Server VM GraalVM CE 22.3.1 (build 11.0.18+10-jvmci-22.3-b13, mixed mode)

@selhagani
Copy link
Member

Hi @anshu-zs,

Thanks for reaching out to us!

I noticed that you're currently using GraalVM CE 22.3.1. Have you had a chance to test our latest version, GraalVM CE 22.3.3? It's our most recent release and includes the latest fixes we have available. This might help resolve the issue you're encountering.

If you've already tested with GraalVM CE 22.3.3 and the problem persists, could you provide a concise reproducer? Additionally, it would be helpful to know which OS version you're using and your system's architecture.

@anshu-zs
Copy link
Author

anshu-zs commented May 7, 2024

Hi @anshu-zs,

Thanks for reaching out to us!

I noticed that you're currently using GraalVM CE 22.3.1. Have you had a chance to test our latest version, GraalVM CE 22.3.3? It's our most recent release and includes the latest fixes we have available. This might help resolve the issue you're encountering.

If you've already tested with GraalVM CE 22.3.3 and the problem persists, could you provide a concise reproducer? Additionally, it would be helpful to know which OS version you're using and your system's architecture.

Hi @selhagani Thank you for replying, I installed graalvm-ce-java11-22.3.3 macOS amd64 (although I'm using mac with aarch64 ) from here.

PS: I installed the graalvm-ce-java11-22.3.3 macOS amd64 since I wasn't unable to find graal vm 22.3.3 for macOS arm64

On running the below command to create native image

native-image --no-fallback -H:ConfigurationFileDirectories=/Users/raramuri/Desktop/Anshu/rocket/rocket-examples/src/main/resources/META-INF/native-image --initialize-at-build-time=org.slf4j.LoggerFactory,ch.qos.logback,io.netty,examples.http.controller.ProductController,io.github.classgraph.,nonapi.io.github.classgraph,examples.http.Main,com.zopsmart.rocket.engine.scanner.ClassScanner    -H:+ReportUnsupportedElementsAtRuntime  -H:+AllowJRTFileSystem  -H:Class=examples.http.Main  -jar rocket-examples-0.31.0.jar

I'm getting this error

zsh: command not found: native-image

Here are my system configurations:

  • OS: macOS Sonoma
  • Architecture: ARM64

Here is JDK version

openjdk 11.0.20 2023-07-18
OpenJDK Runtime Environment GraalVM CE 22.3.3 (build 11.0.20+8-jvmci-22.3-b22)
OpenJDK 64-Bit Server VM GraalVM CE 22.3.3 (build 11.0.20+8-jvmci-22.3-b22, mixed mode, sharing)

Reproducer:
I'm using an in house framework which is pretty much big, so it might not be feasible for me to reproduce this issue. Also I don't have clear understanding about the above exception I'm facing ,so I'm not certain from where this issue might be originating and how can this issue be reproduced.


Here are the full stack stack traces



Error: java.util.concurrent.ExecutionException: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: type is not available in this platform: com.oracle.svm.hosted.NativeImageSystemClassLoader
com.oracle.graal.pointsto.util.AnalysisError: java.util.concurrent.ExecutionException: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: type is not available in this platform: com.oracle.svm.hosted.NativeImageSystemClassLoader
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.AnalysisError.shouldNotReachHere(AnalysisError.java:173)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.AnalysisFuture.ensureDone(AnalysisFuture.java:66)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.lambda$postTask$12(ImageHeapScanner.java:663)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.CompletionExecutor.executeCommand(CompletionExecutor.java:193)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.CompletionExecutor.lambda$executeService$0(CompletionExecutor.java:177)
        at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1426)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Caused by: java.util.concurrent.ExecutionException: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: type is not available in this platform: com.oracle.svm.hosted.NativeImageSystemClassLoader
        at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
        at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.AnalysisFuture.ensureDone(AnalysisFuture.java:64)
        ... 9 more
Caused by: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: type is not available in this platform: com.oracle.svm.hosted.NativeImageSystemClassLoader
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisUniverse.createType(AnalysisUniverse.java:222)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisUniverse.lookupAllowUnresolved(AnalysisUniverse.java:213)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisUniverse.lookup(AnalysisUniverse.java:190)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisMethod.<init>(AnalysisMethod.java:129)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.PointsToAnalysisMethod.<init>(PointsToAnalysisMethod.java:62)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.PointsToAnalysisFactory.createMethod(PointsToAnalysisFactory.java:35)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisUniverse.createMethod(AnalysisUniverse.java:453)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisUniverse.lookupAllowUnresolved(AnalysisUniverse.java:441)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisUniverse.lookup(AnalysisUniverse.java:417)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisUniverse.lookup(AnalysisUniverse.java:75)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.infrastructure.UniverseMetaAccess.lookupJavaMethod(UniverseMetaAccess.java:93)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisMetaAccess.lookupJavaMethod(AnalysisMetaAccess.java:71)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.reflect.ReflectionFeature.createAccessor(ReflectionFeature.java:156)
        at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1705)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.reflect.ReflectionFeature.getOrCreateAccessor(ReflectionFeature.java:123)
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.reflect.target.ExecutableAccessorComputer.transform(ExecutableAccessorComputer.java:43)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.substitute.ComputedValueField.computeValue(ComputedValueField.java:343)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.substitute.ComputedValueField.readValue(ComputedValueField.java:313)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.ameta.AnalysisConstantReflectionProvider.readHostedFieldValue(AnalysisConstantReflectionProvider.java:123)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.heap.SVMImageHeapScanner.readHostedFieldValue(SVMImageHeapScanner.java:122)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.createImageHeapObject(ImageHeapScanner.java:277)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.lambda$getOrCreateConstantReachableTask$2(ImageHeapScanner.java:203)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.AnalysisFuture.ensureDone(AnalysisFuture.java:63)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.getOrCreateConstantReachableTask(ImageHeapScanner.java:215)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.heap.SVMImageHeapScanner.getOrCreateConstantReachableTask(SVMImageHeapScanner.java:95)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.markConstantReachable(ImageHeapScanner.java:179)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.onArrayElementReachable(ImageHeapScanner.java:393)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.createImageHeapObject(ImageHeapScanner.java:258)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.lambda$getOrCreateConstantReachableTask$2(ImageHeapScanner.java:203)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.AnalysisFuture.ensureDone(AnalysisFuture.java:63)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.getOrCreateConstantReachableTask(ImageHeapScanner.java:215)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.heap.SVMImageHeapScanner.getOrCreateConstantReachableTask(SVMImageHeapScanner.java:95)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.markConstantReachable(ImageHeapScanner.java:179)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.onFieldValueReachable(ImageHeapScanner.java:357)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.lambda$createImageHeapObject$3(ImageHeapScanner.java:284)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.AnalysisFuture.ensureDone(AnalysisFuture.java:63)
        ... 9 more

@selhagani
Copy link
Member

I understand your concern. In this case, I'd recommend trying out GraalVM for JDK 22. It's compatible with macOS arm64, and you can easily select the version you need from the options available here.

Give this version a test run, and let me know if you still encounter the same issue. I'm here to assist you further if you need any additional support.

@anshu-zs
Copy link
Author

anshu-zs commented May 9, 2024

Hi @selhagani
I tried GraalVM for JDK 22 but I'm facing this error

Warning: The option '-H:ReflectionConfigurationResources=META-INF/native-image/io.grpc.netty.shaded.io.netty/netty-transport/reflection-config.json' is experimental and must be enabled via '-H:+UnlockExperimentalVMOptions' in the future.
Warning: The option '-H:IncludeResources=application\.properties' is experimental and must be enabled via '-H:+UnlockExperimentalVMOptions' in the future.
Warning: The option '-H:IncludeResources=application\.conf' is experimental and must be enabled via '-H:+UnlockExperimentalVMOptions' in the future.
Warning: The option '-H:IncludeResources=application\.json' is experimental and must be enabled via '-H:+UnlockExperimentalVMOptions' in the future.
Warning: The option '-H:IncludeResources=.*Driver\.properties' is experimental and must be enabled via '-H:+UnlockExperimentalVMOptions' in the future.
Warning: The option '-H:DynamicProxyConfigurationResources=META-INF/native-image/com.datastax.oss/java-driver-core/proxy.json' is experimental and must be enabled via '-H:+UnlockExperimentalVMOptions' in the future.
Warning: The option '-H:+ReportUnsupportedElementsAtRuntime' is experimental and must be enabled via '-H:+UnlockExperimentalVMOptions' in the future.
Warning: The option '-H:ReflectionConfigurationResources=META-INF/native-image/com.datastax.oss/java-driver-core/reflection.json' is experimental and must be enabled via '-H:+UnlockExperimentalVMOptions' in the future.
Warning: The option '-H:IncludeResources=reference\.conf' is experimental and must be enabled via '-H:+UnlockExperimentalVMOptions' in the future.
Warning: The option '-H:+AllowJRTFileSystem' is experimental and must be enabled via '-H:+UnlockExperimentalVMOptions' in the future.
Warning: The option '-H:ReflectionConfigurationResources=META-INF/native-image/io.netty/netty-transport/reflection-config.json' is experimental and must be enabled via '-H:+UnlockExperimentalVMOptions' in the future.
Warning: Please re-evaluate whether any experimental option is required, and either remove or unlock it. The build output lists all active experimental options, including where they come from and possible alternatives. If you think an experimental option should be considered as stable, please file an issue.
========================================================================================================================
GraalVM Native Image: Generating 'rocket-examples-0.31.0' (executable)...
========================================================================================================================
Scanner:[]            

[1/8] Initializing...                                                                                    (0.0s @ 0.34GB)
Error: Substitution target for org.wildfly.common.Substitutions$Target_GraalDirectives is not loaded. Use field `onlyWith` in the `TargetClass` annotation to make substitution only active when needed.
com.oracle.svm.core.util.UserError$UserException: Substitution target for org.wildfly.common.Substitutions$Target_GraalDirectives is not loaded. Use field `onlyWith` in the `TargetClass` annotation to make substitution only active when needed.
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.util.UserError.abort(UserError.java:85)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.findTargetClass(AnnotationSubstitutionProcessor.java:1068)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.findTargetClass(AnnotationSubstitutionProcessor.java:1017)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.findTargetClass(AnnotationSubstitutionProcessor.java:1013)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.handleClass(AnnotationSubstitutionProcessor.java:346)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.init(AnnotationSubstitutionProcessor.java:324)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.createAnnotationSubstitutionProcessor(NativeImageGenerator.java:1059)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.setupNativeImage(NativeImageGenerator.java:926)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:569)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:537)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:526)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:701)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.start(NativeImageGeneratorRunner.java:140)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:95)
------------------------------------------------------------------------------------------------------------------------
                        0.7s (16.4% of total time) in 36 GCs | Peak RSS: 0.81GB | CPU load: 4.34
========================================================================================================================
Failed generating 'rocket-examples-0.31.0' after 3.9s.


Graal VM configurations

openjdk 22.0.1 2024-04-16
OpenJDK Runtime Environment GraalVM CE 22.0.1+8.1 (build 22.0.1+8-jvmci-b01)
OpenJDK 64-Bit Server VM GraalVM CE 22.0.1+8.1 (build 22.0.1+8-jvmci-b01, mixed mode, sharing)

@selhagani
Copy link
Member

I noticed that since upgrading to GraalVM for JDK 22, you've encountered a new error. The error message suggests using the 'onlyWith' field in the TargetClass annotation to make substitution active only when necessary. It might be beneficial to review how your substitution-related annotations are configured. To provide more specific assistance, I really need a concise reproducer for the issue. Thanks!

@anshu-zs
Copy link
Author

Hi @selhagani , thanks for replying.
The latest version of graal vm supports only jdk 22 while my project is compatible with java 11 so I guess that can be one of the reason why I'm encountering this error.

Apart from that classgraph is only working with version 22.3.x of graal vm, but at the time of image building I'm getting UnsupportedFeatureException mentioned here

So I'm not sure how to proceed with version 22.3.x and which version to use at which classgraph might be working

@selhagani
Copy link
Member

Hi @anshu-zs, I understand that your project is currently compatible with Java 11. However, please note that Native Image is an early adopter technology, and as such, we only support the latest versions, which are JDK 17 and JDK 21.

Additionally, please be aware that version 22.3 is a discontinued release and will no longer receive any updates.

Regarding the ClassGraph issue, I see that you have an open ticket on that subject. I recommend following up on that ticket for further assistance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants