Skip to content

Caused by: java.lang.IllegalArgumentException: Method "list" could not be invoked #8541

Open
@anshu-zs

Description

@anshu-zs

Hi,
I created a native image executable by using tracing agent which collects reachability meta data but when I'm trying to run the native image I'm getting this exception.

Exception in thread "main" io.github.classgraph.ClassGraphException: Uncaught exception during scan
        at io.github.classgraph.ClassGraph.scan(ClassGraph.java:1637)
        at io.github.classgraph.ClassGraph.scan(ClassGraph.java:1654)
        at io.github.classgraph.ClassGraph.scan(ClassGraph.java:1667)
        at com.zopsmart.rocket.engine.scanner.ClassScanner.scanClasses(ClassScanner.java:42)
        at com.zopsmart.rocket.engine.DependencyEngine.build(DependencyEngine.java:714)
        at com.zopsmart.rocket.engine.EngineManager.buildDependencyStore(EngineManager.java:68)
        at com.zopsmart.rocket.context.ContextManager.initStores(ContextManager.java:67)
        at com.zopsmart.rocket.context.ContextManager.initPrimaryContexts(ContextManager.java:48)
        at com.zopsmart.rocket.context.ContextManager.<init>(ContextManager.java:37)
        at com.zopsmart.rocket.Rocket.initialize(Rocket.java:44)
        at com.zopsmart.rocket.Rocket.run(Rocket.java:99)
        at examples.http.Main.main(Main.java:10)
Caused by: java.lang.IllegalArgumentException: Method "list" could not be invoked
        at nonapi.io.github.classgraph.reflection.ReflectionUtils.invokeMethod(ReflectionUtils.java:230)
        at io.github.classgraph.ModuleReaderProxy.list(ModuleReaderProxy.java:111)
        at io.github.classgraph.ClasspathElementModule.scanPaths(ClasspathElementModule.java:318)
        at io.github.classgraph.Scanner$4.processWorkUnit(Scanner.java:1100)
        at io.github.classgraph.Scanner$4.processWorkUnit(Scanner.java:1094)
        at nonapi.io.github.classgraph.concurrency.WorkQueue.runWorkLoop(WorkQueue.java:246)
        at nonapi.io.github.classgraph.concurrency.WorkQueue.access$000(WorkQueue.java:50)
        at nonapi.io.github.classgraph.concurrency.WorkQueue$1.call(WorkQueue.java:201)
        at nonapi.io.github.classgraph.concurrency.WorkQueue$1.call(WorkQueue.java:198)
        at [email protected]/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at [email protected]/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at [email protected]/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at [email protected]/java.lang.Thread.run(Thread.java:829)
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:775)
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.posix.thread.PosixPlatformThreads.pthreadStartRoutine(PosixPlatformThreads.java:203)
Caused by: java.lang.reflect.InvocationTargetException
        at [email protected]/java.lang.reflect.Method.invoke(Method.java:566)
        at nonapi.io.github.classgraph.reflection.StandardReflectionDriver.invokeMethod(StandardReflectionDriver.java:193)
        at nonapi.io.github.classgraph.reflection.ReflectionUtils.invokeMethod(ReflectionUtils.java:227)
        ... 14 more
Caused by: com.oracle.svm.core.jdk.UnsupportedFeatureError: JRT file system is disabled
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.util.VMError.unsupportedFeature(VMError.java:89)
        at [email protected]/jdk.internal.module.SystemModuleFinders$SystemImage.reader(SystemModuleFinders.java:139)
        at [email protected]/jdk.internal.module.SystemModuleFinders$ModuleContentSpliterator.<init>(SystemModuleFinders.java:508)
        at [email protected]/jdk.internal.module.SystemModuleFinders$SystemModuleReader.list(SystemModuleFinders.java:483)
        ... 17 more

created the native image using this command :

 native-image --no-fallback   -H:ConfigurationFileDirectories=META-INF/native-image --initialize-at-build-time=org.slf4j.LoggerFactory,ch.qos.logback,io.netty  -H:+ReportUnsupportedElementsAtRuntime    -H:Class=examples.http.Main  -cp rocket-examples-0.31.0.jar

Here is the output while creating native image

========================================================================
GraalVM Native Image: Generating 'examples.http.main' (executable)...
========================================================================================================================
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 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 ccom.zopsmart.rocket.rlog.SystemData for reflection configuration. Reason: java.lang.ClassNotFoundException: ccom.zopsmart.rocket.rlog.SystemData.
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 nonapi.io.github.classgraph.classloaderhandler for reflection configuration. Reason: java.lang.ClassNotFoundException: nonapi.io.github.classgraph.classloaderhandler.
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,com.zopsmart.rocket.logger.JsonFormatter for reflection configuration. Reason: java.lang.ClassNotFoundException: com.zopsmart.rocket,com.zopsmart.rocket.logger.JsonFormatter.
Warning: Could not resolve ccom.zopsmart.rocket.rlog.SystemData for reflection configuration. Reason: java.lang.ClassNotFoundException: ccom.zopsmart.rocket.rlog.SystemData.
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 nonapi.io.github.classgraph.classloaderhandler for reflection configuration. Reason: java.lang.ClassNotFoundException: nonapi.io.github.classgraph.classloaderhandler.
Warning: Could not resolve com.zopsmart.rocket.oauth. for reflection configuration. Reason: java.lang.ClassNotFoundException: com.zopsmart.rocket.oauth..
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.
[1/7] Initializing...                                                                                   (11.8s @ 0.76GB)
 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 07, 2024 3:48:14 PM com.google.api.gax.nativeimage.NativeImageUtils registerClassForReflection
WARNING: Failed to find io.grpc.netty.shaded.io.netty.channel.ProtocolNegotiators on the classpath for reflection.
15:48:29,400 |-INFO in ch.qos.logback.classic.LoggerContext[default] - This is logback-classic version ?
15:48:29,401 |-INFO in ch.qos.logback.classic.util.ContextInitializer@1dbf8787 - No custom configurators were discovered as a service.
15:48:29,401 |-INFO in ch.qos.logback.classic.util.ContextInitializer@1dbf8787 - Trying to configure with ch.qos.logback.classic.joran.SerializedModelConfigurator
15:48:29,401 |-INFO in ch.qos.logback.classic.util.ContextInitializer@1dbf8787 - Constructed configurator of type class ch.qos.logback.classic.joran.SerializedModelConfigurator
15:48:29,402 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.scmo]
15:48:29,402 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.scmo]
15:48:29,404 |-INFO in ch.qos.logback.classic.util.ContextInitializer@1dbf8787 - ch.qos.logback.classic.joran.SerializedModelConfigurator.configure() call lasted 1 milliseconds. ExecutionStatus=INVOKE_NEXT_IF_ANY
15:48:29,404 |-INFO in ch.qos.logback.classic.util.ContextInitializer@1dbf8787 - Trying to configure with ch.qos.logback.classic.util.DefaultJoranConfigurator
15:48:29,404 |-INFO in ch.qos.logback.classic.util.ContextInitializer@1dbf8787 - Constructed configurator of type class ch.qos.logback.classic.util.DefaultJoranConfigurator
15:48:29,404 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
15:48:29,404 |-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]
15:48:29,405 |-INFO in ch.qos.logback.core.joran.spi.ConfigurationWatchList@718a18d0 - 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
15:48:29,441 |-INFO in ch.qos.logback.core.joran.action.ConversionRuleAction - registering conversion word colorize with class [org.tuxdude.logback.extensions.LogColorizer]
15:48:29,453 |-INFO in ch.qos.logback.classic.model.processor.LoggerModelHandler - Setting level of logger [io] to OFF
15:48:29,453 |-INFO in ch.qos.logback.classic.model.processor.LoggerModelHandler - Setting level of logger [org] to OFF
15:48:29,453 |-INFO in ch.qos.logback.classic.model.processor.LoggerModelHandler - Setting level of logger [com.zaxxer] to OFF
15:48:29,453 |-INFO in ch.qos.logback.classic.model.processor.LoggerModelHandler - Setting level of logger [com.datastax] to OFF
15:48:29,453 |-INFO in ch.qos.logback.classic.model.processor.LoggerModelHandler - Setting level of logger [net] to OFF
15:48:29,453 |-INFO in ch.qos.logback.classic.model.processor.LoggerModelHandler - Setting level of logger [io.lettuce] to OFF
15:48:29,453 |-INFO in ch.qos.logback.classic.model.processor.LoggerModelHandler - Setting level of logger [reactor.util] to OFF
15:48:29,453 |-INFO in ch.qos.logback.classic.model.processor.LoggerModelHandler - Setting level of logger [reactor.core] to OFF
15:48:29,453 |-INFO in ch.qos.logback.classic.model.processor.LoggerModelHandler - Setting level of logger [reactor] to OFF
15:48:29,453 |-INFO in ch.qos.logback.classic.model.processor.LoggerModelHandler - Setting level of logger [com.azure] to OFF
15:48:29,453 |-INFO in ch.qos.logback.classic.model.processor.LoggerModelHandler - Setting level of logger [reactor.netty] to OFF
15:48:29,453 |-INFO in ch.qos.logback.classic.model.processor.LoggerModelHandler - Setting level of logger [software.amazon.awssdk] to OFF
15:48:29,453 |-INFO in ch.qos.logback.classic.model.processor.LoggerModelHandler - Setting level of logger [com.amazonaws] to OFF
15:48:29,453 |-INFO in ch.qos.logback.core.model.processor.AppenderModelHandler - Processing appender named [STDOUT]
15:48:29,454 |-INFO in ch.qos.logback.core.model.processor.AppenderModelHandler - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
15:48:29,455 |-INFO in ch.qos.logback.classic.model.processor.RootLoggerModelHandler - Setting level of ROOT logger to TRACE
15:48:29,455 |-INFO in ch.qos.logback.core.model.processor.AppenderRefModelHandler - Attaching appender named [STDOUT] to Logger[ROOT]
15:48:29,455 |-INFO in ch.qos.logback.core.model.processor.DefaultProcessor@7de59370 - End of configuration.
15:48:29,455 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@5c084884 - Registering current configuration as safe fallback point
15:48:29,455 |-INFO in ch.qos.logback.classic.util.ContextInitializer@1dbf8787 - ch.qos.logback.classic.util.DefaultJoranConfigurator.configure() call lasted 51 milliseconds. ExecutionStatus=DO_NOT_INVOKE_NEXT_IF_ANY
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
[2/7] Performing analysis...  [************]                                                           (136.3s @ 3.01GB)
  24,986 (91.35%) of 27,351 classes reachable
  51,274 (70.74%) of 72,478 fields reachable
 172,151 (57.61%) of 298,842 methods reachable
   1,305 classes, 3,131 fields, and 21,411 methods registered for reflection
      95 classes,   123 fields, and    70 methods registered for JNI access
       6 native libraries: -framework CoreServices, -framework Foundation, dl, pthread, stdc++, z
[3/7] Building universe...                                                                              (41.6s @ 3.61GB)
[4/7] Parsing methods...      [******]                                                                  (36.0s @ 3.13GB)
GC warning: 19.0s spent in 6 GCs during the last stage, taking up 52.43% of the time.
            Please ensure more than 2.05GB of memory is available for Native Image
            to reduce GC overhead and improve image build time.
[5/7] Inlining methods...     [***]                                                                     (12.1s @ 1.85GB)
[6/7] Compiling methods...    [********]                                                                (64.3s @ 2.91GB)
[7/7] Creating image...                                                                                 (16.2s @ 3.67GB)
  61.30MB (53.03%) for code area:   112,334 compilation units
  53.03MB (45.88%) for image heap:  519,359 objects and 103 resources
   1.26MB ( 1.09%) for other data
 115.59MB in total
------------------------------------------------------------------------------------------------------------------------
Top 10 packages in code area:                               Top 10 object types in image heap:
   2.72MB com.google.protobuf                                 13.09MB byte[] for code metadata
   1.64MB i.g.xds.shaded.io.envoyproxy.envoy.config.core.v3    7.20MB java.lang.Class
   1.59MB sun.security.ssl                                     5.36MB byte[] for java.lang.String
   1.46MB i.g.x.shaded.io.envoyproxy.envoy.config.route.v3     4.95MB java.lang.String
   1.16MB java.lang.invoke                                     3.78MB byte[] for general heap data
   1.05MB java.util                                            3.62MB byte[] for embedded resources
   1.04MB i.g.xds.shaded.io.envoyproxy.envoy.api.v2.route      2.65MB byte[] for reflection metadata
1017.20KB io.grpc.xds.shaded.io.envoyproxy.envoy.api.v2.core   2.29MB com.oracle.svm.core.hub.DynamicHubCompanion
 899.48KB com.google.re2j                                    997.52KB java.lang.String[]
 842.09KB io.grpc.xds                                        933.13KB c.oracle.svm.core.reflect.SubstrateMethodAccessor
  47.31MB for 878 more packages                                7.78MB for 4031 more object types
------------------------------------------------------------------------------------------------------------------------
                       75.0s (22.3% of total time) in 96 GCs | Peak RSS: 2.05GB | CPU load: 2.44
------------------------------------------------------------------------------------------------------------------------
Produced artifacts:
 /Users/raramuri/Desktop/Anshu/rocket/rocket-examples/build/libs/examples.http.main (executable)
 /Users/raramuri/Desktop/Anshu/rocket/rocket-examples/build/libs/examples.http.main.build_artifacts.txt (txt)

GraalVM version:

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)
OS: macOS Sonoma -v 14.3.1
Architecture: arm64

Also, I tried removing below snippets from reflect-config.json file

{
  "name":"jdk.internal.loader.BuiltinClassLoader",
  "allDeclaredFields":true,
  "queryAllDeclaredMethods":true
},
{
  "name":"jdk.internal.loader.ClassLoaders$AppClassLoader",
  "allDeclaredFields":true,
  "queryAllDeclaredMethods":true
},
{
  "name":"jdk.internal.loader.ClassLoaders$PlatformClassLoader",
  "allDeclaredFields":true,
  "queryAllDeclaredMethods":true
},

Thanks

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions