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

"Detected a ZipFile object in the image heap." but object is from graalvm svm #4797

Closed
theotherp opened this issue Aug 6, 2022 · 17 comments
Closed
Assignees

Comments

@theotherp
Copy link

Describe the issue
Building my project using the native-maven-plugin I get the error message Detected a ZipFile object in the image heap.. I attached a debugger and found out that the obj causing the error is the file graalvm-ce-java17-22.3.0-dev\lib\svm\builder\pointsto.jar.
Not sure which information you need but I took a screenshot of the debugger:
image

Steps to reproduce the issue
Please include both build steps as well as run steps

  1. Check out https://github.com/theotherp/nzbhydra2/tree/native
  2. mvn install
  3. In core run mvn package -Pnative -DskipTests -Dmain.port=8080 -Dmain.host=127.0.0.1

Describe GraalVM and your environment:

More details

   Fatal error: org.graalvm.compiler.debug.GraalError: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Detected a ZipFile object in the image heap. A ZipFile object contains pointers to unmanaged C memory and file descriptors, and these resources are no longer available at image runtime.  To see how this object got instantiated use --trace-object-instantiation=java.util.jar.JarFile. The object was probably created by a class initializer and is reachable from a static field. You can request class initialization at image runtime by using the option --initialize-at-run-time=<class-name>. Or you can write your own initialization methods and call them explicitly from your main entry point.
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.AnalysisFuture.setException(AnalysisFuture.java:49)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:269)
        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.lambda$postTask$9(ImageHeapScanner.java:610)
        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:1395)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
Caused by: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Detected a ZipFile object in the image heap. A ZipFile object contains pointers to unmanaged C memory and file descriptors, and these resources are no longer available at image runtime.  To see how this object got instantiated use --trace-object-instantiation=java.util.jar.JarFile. The object was probably created by a class initializer and is reachable from a static field. You can request class initialization at image runtime by using the option --initialize-at-run-time=<class-name>. Or you can write your own initialization methods and call them explicitly from your main entry point.
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.DisallowedImageHeapObjectFeature.error(DisallowedImageHeapObjectFeature.java:173)
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.image.DisallowedImageHeapObjects.check(DisallowedImageHeapObjects.java:118)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.DisallowedImageHeapObjectFeature.replacer(DisallowedImageHeapObjectFeature.java:149)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisUniverse.replaceObject(AnalysisUniverse.java:571)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.ameta.AnalysisConstantReflectionProvider.replaceObject(AnalysisConstantReflectionProvider.java:257)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.ameta.AnalysisConstantReflectionProvider.interceptValue(AnalysisConstantReflectionProvider.java:228)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.heap.SVMImageHeapScanner.transformFieldValue(SVMImageHeapScanner.java:126)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.onFieldValueReachable(ImageHeapScanner.java:330)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.lambda$createImageHeapObject$3(ImageHeapScanner.java:271)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        ... 10 more
@oubidar-Abderrahim
Copy link
Member

Hi, Thank you for reporting this, we will take a look into it and get back to you

@oubidar-Abderrahim oubidar-Abderrahim self-assigned this Aug 11, 2022
@oubidar-Abderrahim
Copy link
Member

I followed the instructions to reproduce and the build stops at: Listening for transport dt_socket at address: 8000 could you please make sure the steps are complete, let me know if I should add something to get the error as you did

@theotherp
Copy link
Author

Just remove--debug-attach in https://github.com/theotherp/nzbhydra2/blob/native/core/pom.xml or attach a debugger to port 8000

@hamadycisse
Copy link

Any update on this issue, I am experiencing the same using the same version of GraalVM. I have 4 modules causing the issue:

  • org.graalvm.nativeimage.builder
  • org.graalvm.nativeimage.base
  • org.graalvm.nativeimage.pointsto
  • org.graalvm.nativeimage.objectfile

@pshirshov
Copy link

pshirshov commented Jan 26, 2023

I'm experiencing the same problem on 22.2 and 22.3. 22.1 works flawlessly.

Looking at the traces I think that this is some kind of a bug in native-image because I only see its codepaths there.

[error] Error: Unsupported features in 4 methods
[error] Detailed message:
[error] Error: Detected a ZipFile object in the image heap. A ZipFile object contains pointers to unmanaged C memory and file descriptors, and these resources are no longer available at image runtime.  Object has been initialized by the com.oracle.svm.hosted.annotation.SubstrateAnnotationExtracter class initializer with a trace:
[error]  	at java.util.jar.JarFile.<init>(JarFile.java:347)
[error] 	at jdk.internal.module.ModuleReferences$JarModuleReader.newJarFile(ModuleReferences.java:230)
[error] 	at jdk.internal.module.ModuleReferences$JarModuleReader.<init>(ModuleReferences.java:237)
[error] 	at jdk.internal.module.ModuleReferences.lambda$newJarModule$0(ModuleReferences.java:94)
[error] 	at jdk.internal.module.ModuleReferences$$Lambda$28/0x00000007c00067a8.get(Unknown Source)
[error] 	at jdk.internal.module.ModuleReferenceImpl.open(ModuleReferenceImpl.java:93)
[error] 	at jdk.internal.loader.BuiltinClassLoader$5.apply(BuiltinClassLoader.java:1023)
[error] 	at jdk.internal.loader.BuiltinClassLoader$5.apply(BuiltinClassLoader.java:1020)
[error] 	at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)
[error] 	at jdk.internal.loader.BuiltinClassLoader.moduleReaderFor(BuiltinClassLoader.java:1031)
[error] 	at jdk.internal.loader.BuiltinClassLoader$2.run(BuiltinClassLoader.java:464)
[error] 	at jdk.internal.loader.BuiltinClassLoader$2.run(BuiltinClassLoader.java:459)
[error] 	at java.security.AccessController.executePrivileged(AccessController.java:807)
[error] 	at java.security.AccessController.doPrivileged(AccessController.java:569)
[error] 	at jdk.internal.loader.BuiltinClassLoader.findMiscResource(BuiltinClassLoader.java:458)
[error] 	at jdk.internal.loader.BuiltinClassLoader.findResources(BuiltinClassLoader.java:385)
[error] 	at java.lang.ClassLoader.getResources(ClassLoader.java:1468)
[error] 	at java.lang.ClassLoader.getResources(ClassLoader.java:1464)
[error] 	at java.util.ServiceLoader$LazyClassPathLookupIterator.nextProviderClass(ServiceLoader.java:1203)
[error] 	at java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1228)
[error] 	at java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1273)
[error] 	at java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1309)
[error] 	at java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1393)
[error] 	at jdk.vm.ci.services.JVMCIServiceLocator.getProviders(JVMCIServiceLocator.java:109)
[error] 	at jdk.vm.ci.hotspot.HotSpotJVMCICompilerConfig.getJVMCICompilerFactories(HotSpotJVMCICompilerConfig.java:159)
[error] 	at jdk.vm.ci.hotspot.HotSpotJVMCICompilerConfig.getCompilerFactory(HotSpotJVMCICompilerConfig.java:119)
[error] 	at jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.<init>(HotSpotJVMCIRuntime.java:594)
[error] 	at jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime(HotSpotJVMCIRuntime.java:183)
[error] 	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Unknown Source)
[error] 	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
[error] 	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error] 	at java.lang.reflect.Method.invoke(Method.java:568)
[error] 	at com.oracle.svm.hosted.annotation.SubstrateAnnotationExtracter.<clinit>(SubstrateAnnotationExtracter.java:129)
[error] . Try avoiding to initialize the class that caused initialization of the direct Buffer. The object was probably created by a class initializer and is reachable from a static field. You can request class initialization at image runtime by using the option --initialize-at-run-time=<class-name>. Or you can write your own initialization methods and call them explicitly from your main entry point.
[error] Trace: Object was reached by
[error]   reading field jdk.internal.module.ModuleReferences$JarModuleReader.jf of constant
[error]     jdk.internal.module.ModuleReferences$JarModuleReader@7e8f307f: jdk.internal.module.ModuleReferences$JarModuleReader@7e8f307f
[error]   reading field java.util.concurrent.ConcurrentHashMap$Node.val of constant
[error]     java.util.concurrent.ConcurrentHashMap$Node@17f8925a: [module org.graalvm.nativeimage.objectfile, location=file:///opt/graalvm-ce-java...
[error]   indexing into array java.util.concurrent.ConcurrentHashMap$Node[]@360ba63e: [Ljava.util.concurrent.ConcurrentHashMap$Node;@360ba63e
[info] ------------------------------------------------------------------------------------------------------------------------
[error]   reading field java.util.concurrent.ConcurrentHashMap.table of constant
[error]     java.util.concurrent.ConcurrentHashMap@44586d79: {[module jdk.compiler, location=jrt:/jdk.compiler]=jdk.internal.module.SystemMod...
[error]   reading field jdk.internal.loader.BuiltinClassLoader.moduleToReader of constant
[error]     jdk.internal.loader.ClassLoaders$AppClassLoader@2cfb4a64: jdk.internal.loader.ClassLoaders$AppClassLoader@2cfb4a64
[error]   reading static field java.lang.ClassLoader.scl
[error] Error: Detected a ZipFile object in the image heap. A ZipFile object contains pointers to unmanaged C memory and file descriptors, and these resources are no longer available at image runtime.  Object has been initialized through the following trace:
[error] 	at java.util.jar.JarFile.<init>(JarFile.java:347)
[error] 	at jdk.internal.module.ModuleReferences$JarModuleReader.newJarFile(ModuleReferences.java:230)
[error] 	at jdk.internal.module.ModuleReferences$JarModuleReader.<init>(ModuleReferences.java:237)
[error] 	at jdk.internal.module.ModuleReferences.lambda$newJarModule$0(ModuleReferences.java:94)
[error] 	at jdk.internal.module.ModuleReferences$$Lambda$28/0x00000007c00067a8.get(Unknown Source)
[error] 	at jdk.internal.module.ModuleReferenceImpl.open(ModuleReferenceImpl.java:93)
[error] 	at jdk.internal.loader.BuiltinClassLoader$5.apply(BuiltinClassLoader.java:1023)
[error] 	at jdk.internal.loader.BuiltinClassLoader$5.apply(BuiltinClassLoader.java:1020)
[error] 	at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)
[error] 	at jdk.internal.loader.BuiltinClassLoader.moduleReaderFor(BuiltinClassLoader.java:1031)
[error] 	at jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:793)
[error] 	at jdk.internal.loader.BuiltinClassLoader.findClassInModuleOrNull(BuiltinClassLoader.java:741)
[error] 	at jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:665)
[error] 	at jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:639)
[error] 	at jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
[error] 	at java.lang.ClassLoader.loadClass(ClassLoader.java:520)
[error] 	at java.lang.Class.getDeclaredMethods0(Unknown Source)
[error] 	at java.lang.Class.privateGetDeclaredMethods(Class.java:3402)
[error] 	at java.lang.Class.getMethodsRecursive(Class.java:3543)
[error] 	at java.lang.Class.getMethod0(Class.java:3529)
[error] 	at java.lang.Class.getMethod(Class.java:2225)
[error] 	at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:847)
[error] 	at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:706)
[error] . Try avoiding to initialize the class that caused initialization of the direct Buffer. The object was probably created by a class initializer and is reachable from a static field. You can request class initialization at image runtime by using the option --initialize-at-run-time=<class-name>. Or you can write your own initialization methods and call them explicitly from your main entry point.
[error] Trace: Object was reached by
[error]   reading field jdk.internal.module.ModuleReferences$JarModuleReader.jf of constant
[error]     jdk.internal.module.ModuleReferences$JarModuleReader@61ebe300: jdk.internal.module.ModuleReferences$JarModuleReader@61ebe300
[error]   reading field java.util.concurrent.ConcurrentHashMap$Node.val of constant
[error]     java.util.concurrent.ConcurrentHashMap$Node@70cb3d6e: [module org.graalvm.nativeimage.pointsto, location=file:///opt/graalvm-ce-java17...
[error]   indexing into array java.util.concurrent.ConcurrentHashMap$Node[]@360ba63e: [Ljava.util.concurrent.ConcurrentHashMap$Node;@360ba63e
[error]   reading field java.util.concurrent.ConcurrentHashMap.table of constant
[error]     java.util.concurrent.ConcurrentHashMap@44586d79: {[module jdk.compiler, location=jrt:/jdk.compiler]=jdk.internal.module.SystemMod...
[error]   reading field jdk.internal.loader.BuiltinClassLoader.moduleToReader of constant
[error]     jdk.internal.loader.ClassLoaders$AppClassLoader@2cfb4a64: jdk.internal.loader.ClassLoaders$AppClassLoader@2cfb4a64
[error]   reading static field java.lang.ClassLoader.scl
[error] Error: Detected a ZipFile object in the image heap. A ZipFile object contains pointers to unmanaged C memory and file descriptors, and these resources are no longer available at image runtime.  Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked. The object was probably created by a class initializer and is reachable from a static field. You can request class initialization at image runtime by using the option --initialize-at-run-time=<class-name>. Or you can write your own initialization methods and call them explicitly from your main entry point.
[error] Trace: Object was reached by

@pshirshov
Copy link

pshirshov commented Feb 5, 2023

Ok, in my case this was caused by the rules for https://github.com/classgraph/classgraph which were automatically generated by the agent.

I may also note that classgraph was not effectively reachable in the project, there was an if (false) clause guarding the code invoking it.

@Scui1
Copy link

Scui1 commented Mar 18, 2023

Ok, in my case this was caused by the rules for https://github.com/classgraph/classgraph which were automatically generated by the agent.

I may also note that classgraph was not effectively reachable in the project, there was an if (false) clause guarding the code invoking it.

How did you fix it? Never heard of this classgraph thing, is there any way to see if my project uses this aswell and therefore fails?

@Berstanio
Copy link

@Scui1
I encountered the same bug, for me it was because I tried to register one of the following classes and their methods and fields for reflection access:
https://gist.github.com/Berstanio/37ee4912eadace6d726fe3191b23dfe8
I don't know which one exactly caused it, I didn't bothered to dig deeper. That I tried to register the classes in the first place was a bug in my code.

However, I think the error that is thrown is quite misleading. From what I debugged, it seems like that on the first startup the jvm tries to load the main method in com.oracle.svm.hosted.NativeImageGeneratorRunner.

But "java.lang.Class.getDeclaredMethods0" on the NativeImageGeneratorRunner class tries to load (for whatever reason) "com.oracle.graal.pointsto.util.AnalysisError$ParsingError", which results in loading the pointsto jar.
This jar loading leads than to the "Detected a ZipFile object" error.

[error] 	at java.util.jar.JarFile.<init>(JarFile.java:347)
[error] 	at jdk.internal.module.ModuleReferences$JarModuleReader.newJarFile(ModuleReferences.java:230)
[error] 	at jdk.internal.module.ModuleReferences$JarModuleReader.<init>(ModuleReferences.java:237)
[error] 	at jdk.internal.module.ModuleReferences.lambda$newJarModule$0(ModuleReferences.java:94)
[error] 	at jdk.internal.module.ModuleReferences$$Lambda$28/0x00000007c00067a8.get(Unknown Source)
[error] 	at jdk.internal.module.ModuleReferenceImpl.open(ModuleReferenceImpl.java:93)
[error] 	at jdk.internal.loader.BuiltinClassLoader$5.apply(BuiltinClassLoader.java:1023)
[error] 	at jdk.internal.loader.BuiltinClassLoader$5.apply(BuiltinClassLoader.java:1020)
[error] 	at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)
[error] 	at jdk.internal.loader.BuiltinClassLoader.moduleReaderFor(BuiltinClassLoader.java:1031)
[error] 	at jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:793)
[error] 	at jdk.internal.loader.BuiltinClassLoader.findClassInModuleOrNull(BuiltinClassLoader.java:741)
[error] 	at jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:665)
[error] 	at jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:639)
[error] 	at jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
[error] 	at java.lang.ClassLoader.loadClass(ClassLoader.java:520)
[error] 	at java.lang.Class.getDeclaredMethods0(Unknown Source) <---- Tries to load 
[error] 	at java.lang.Class.privateGetDeclaredMethods(Class.java:3402)
[error] 	at java.lang.Class.getMethodsRecursive(Class.java:3543)
[error] 	at java.lang.Class.getMethod0(Class.java:3529)
[error] 	at java.lang.Class.getMethod(Class.java:2225)
[error] 	at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:847) <--- Wants to find main method
[error] 	at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:706)

@kxmas
Copy link

kxmas commented Apr 20, 2023

I'm seeing a similar message with GraalVM 22.3.1 Java 17 CE (Java Version 17.0.6+10-jvmci-22.3-b13)

Detailed message: Error: Detected a ZipFile object in the image heap. A ZipFile object contains pointers to unmanaged C memory and file descriptors, and these resources are no longer available at image runtime. Object has been initialized by the com.oracle.svm.hosted.annotation.SubstrateAnnotationExtracter class initializer with a trace: at java.util.jar.JarFile.<init>(JarFile.java:347) at jdk.internal.module.ModuleReferences$JarModuleReader.newJarFile(ModuleReferences.java:230) at jdk.internal.module.ModuleReferences$JarModuleReader.<init>(ModuleReferences.java:237) at jdk.internal.module.ModuleReferences.lambda$newJarModule$0(ModuleReferences.java:94) at jdk.internal.module.ModuleReferences$$Lambda$28/0x00000007c0004c48.get(Unknown Source) at jdk.internal.module.ModuleReferenceImpl.open(ModuleReferenceImpl.java:93) at jdk.internal.loader.BuiltinClassLoader$5.apply(BuiltinClassLoader.java:1023) at jdk.internal.loader.BuiltinClassLoader$5.apply(BuiltinClassLoader.java:1020) at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708) at jdk.internal.loader.BuiltinClassLoader.moduleReaderFor(BuiltinClassLoader.java:1031) at jdk.internal.loader.BuiltinClassLoader$2.run(BuiltinClassLoader.java:464) at jdk.internal.loader.BuiltinClassLoader$2.run(BuiltinClassLoader.java:459) at java.security.AccessController.executePrivileged(AccessController.java:807) at java.security.AccessController.doPrivileged(AccessController.java:569) at jdk.internal.loader.BuiltinClassLoader.findMiscResource(BuiltinClassLoader.java:458) at jdk.internal.loader.BuiltinClassLoader.findResources(BuiltinClassLoader.java:385) at java.lang.ClassLoader.getResources(ClassLoader.java:1468)

I'm not sure where to go from here.

@pshirshov
Copy link

pshirshov commented Apr 21, 2023

Start with an empty project and then gradually adding dependencies and code.

@nareshkumarthota
Copy link

Facing similar issue. Any workaround for this?

Error: Unsupported features in 4 methods
Detailed message:
Error: Detected a ZipFile object in the image heap. A ZipFile object contains pointers to unmanaged C memory and file descriptors, and these resources are no longer available at image runtime.  To see how this object got instantiated use --trace-object-instantiation=java.util.jar.JarFile. The object was probably created by a class initializer and is reachable from a static field. You can request class initialization at image runtime by using the option --initialize-at-run-time=<class-name>. Or you can write your own initialization methods and call them explicitly from your main entry point.
Trace: Object was reached by
  reading field jdk.internal.module.ModuleReferences$JarModuleReader.jf of constant 
    jdk.internal.module.ModuleReferences$JarModuleReader@9e8d7cf: jdk.internal.module.ModuleReferences$JarModuleReader@9e8d7cf
  reading field java.util.concurrent.ConcurrentHashMap$Node.val of constant 
    java.util.concurrent.ConcurrentHashMap$Node@57aad4e7: [module org.graalvm.nativeimage.objectfile, location=file:///home/naresh/apps/gr...
  indexing into array java.util.concurrent.ConcurrentHashMap$Node[]@628cdcc7: [Ljava.util.concurrent.ConcurrentHashMap$Node;@628cdcc7
  reading field java.util.concurrent.ConcurrentHashMap.table of constant 
    java.util.concurrent.ConcurrentHashMap@65a8243d: {[module jdk.jstatd, location=jrt:/jdk.jstatd]=jdk.internal.module.SystemModuleF...
  reading field jdk.internal.loader.BuiltinClassLoader.moduleToReader of constant 
    jdk.internal.loader.ClassLoaders$AppClassLoader@71f2a7d5: jdk.internal.loader.ClassLoaders$AppClassLoader@71f2a7d5
  reading static field java.lang.ClassLoader.scl

@oubidar-Abderrahim
Copy link
Member

@nareshkumarthota Can you share a small reproducer to this issue please?

@nareshkumarthota
Copy link

nareshkumarthota commented Sep 8, 2023

@oubidar-Abderrahim Thats a licensed product. I have found the solution by doing trial and error. The problem is with metadata genaration with agent lib.

In reflect-config.json removed below lines, Then able to build my native-image.

{
  "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
}

@oubidar-Abderrahim
Copy link
Member

@theotherp does the above solution solve your issue as well? if no can you update your reproducer, I'm no longer able to build it locally.

@oubidar-Abderrahim
Copy link
Member

Since we cannot faithfully reproduce this issue locally, we'll close this ticket for now. If someone is still facing this issue and can provide a reproducer to it, please reopen the issue, or better, create a new one, and we'll be happy to work on it. Thank you.

@kdldbq
Copy link

kdldbq commented Dec 13, 2023

@oubidar-Abderrahim Thats a licensed product. I have found the solution by doing trial and error. The problem is with metadata genaration with agent lib.

In reflect-config.json removed below lines, Then able to build my native-image.

{
  "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
}

It's plausible. After building, having other problematic messages. In my point of view, it must be some Class unloaded cause the ClassLoaders were excluded.

It's quite beyond understanding the procedure of the compilation, should I recognize the problem must be related to some Jar File cause Its stack prints so many times "JarFile", But it doesn't show any File name about the problem jars! I've been troubleshooting this problem for 2 days, I've never seen any helpful stack print, it always prints the classes which is not my own or I don't know what jar is it.

After precluding dependence, one by one, finally realized the https://github.com/PlaytikaOSS/feign-reactive is the bane. However, I decided to give up on compiling.

2023-12-12 22:37:14 ERROR [org.springframework.boot.SpringApplication        ] : Application run failed 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'webHandler': Error creating bean with name 'resourceHandlerMapping': Instantiation of supplied bean failed
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:605)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:520)
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:973)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:941)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:608)
	at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.refresh(ReactiveWebServerApplicationContext.java:66)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:734)
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:436)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:312)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295)
	at cn.edison.epts.auth.dist.AuthApplication.main(AuthApplication.java:30)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'resourceHandlerMapping': Instantiation of supplied bean failed
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainFromSupplier(AbstractAutowireCapableBeanFactory.java:1220)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1158)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:560)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:520)
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:663)
	at org.springframework.context.support.AbstractApplicationContext.getBeansOfType(AbstractApplicationContext.java:1308)
	at org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors(BeanFactoryUtils.java:368)
	at org.springframework.web.reactive.DispatcherHandler.initStrategies(DispatcherHandler.java:120)
	at org.springframework.web.reactive.DispatcherHandler.setApplicationContext(DispatcherHandler.java:115)
	at org.springframework.context.support.ApplicationContextAwareProcessor.invokeAwareInterfaces(ApplicationContextAwareProcessor.java:112)
	at org.springframework.context.support.ApplicationContextAwareProcessor.postProcessBeforeInitialization(ApplicationContextAwareProcessor.java:87)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:419)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1762)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:598)
	... 15 common frames omitted
Caused by: io.github.classgraph.ClassGraphException: Uncaught exception during scan
	at io.github.classgraph.ClassGraph.scan(ClassGraph.java:1606)
	at io.github.classgraph.ClassGraph.scan(ClassGraph.java:1623)
	at io.github.classgraph.ClassGraph.scan(ClassGraph.java:1636)
	at org.webjars.WebJarAssetLocator.scanForWebJars(WebJarAssetLocator.java:188)
	at org.webjars.WebJarAssetLocator.<init>(WebJarAssetLocator.java:210)
	at org.webjars.WebJarAssetLocator.<init>(WebJarAssetLocator.java:194)
	at org.springframework.web.reactive.resource.WebJarsResourceResolver.<init>(WebJarsResourceResolver.java:64)
	at org.springframework.web.reactive.config.ResourceChainRegistration.getResourceResolvers(ResourceChainRegistration.java:114)
	at org.springframework.web.reactive.config.ResourceHandlerRegistration.getRequestHandler(ResourceHandlerRegistration.java:207)
	at org.springframework.web.reactive.config.ResourceHandlerRegistry.getRequestHandler(ResourceHandlerRegistry.java:149)
	at org.springframework.web.reactive.config.ResourceHandlerRegistry.getHandlerMapping(ResourceHandlerRegistry.java:140)
	at org.springframework.web.reactive.config.WebFluxConfigurationSupport.resourceHandlerMapping(WebFluxConfigurationSupport.java:251)
	at org.springframework.web.reactive.config.WebFluxConfigurationSupport__BeanDefinitions.lambda$getResourceHandlerMappingInstanceSupplier$5(WebFluxConfigurationSupport__BeanDefinitions.java:130)
	at org.springframework.util.function.ThrowingBiFunction.apply(ThrowingBiFunction.java:68)
	at org.springframework.util.function.ThrowingBiFunction.apply(ThrowingBiFunction.java:54)
	at org.springframework.beans.factory.aot.BeanInstanceSupplier.lambda$get$2(BeanInstanceSupplier.java:200)
	at org.springframework.util.function.ThrowingSupplier.get(ThrowingSupplier.java:58)
	at org.springframework.util.function.ThrowingSupplier.get(ThrowingSupplier.java:46)
	at org.springframework.beans.factory.aot.BeanInstanceSupplier.invokeBeanSupplier(BeanInstanceSupplier.java:212)
	at org.springframework.beans.factory.aot.BeanInstanceSupplier.get(BeanInstanceSupplier.java:200)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.obtainInstanceFromSupplier(DefaultListableBeanFactory.java:947)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainFromSupplier(AbstractAutowireCapableBeanFactory.java:1214)
	... 32 common frames omitted
Caused by: java.lang.IllegalArgumentException: Method "list" could not be invoked: java.lang.reflect.InvocationTargetException
	at nonapi.io.github.classgraph.reflection.ReflectionUtils.invokeMethod(ReflectionUtils.java:231)
	at io.github.classgraph.ModuleReaderProxy.list(ModuleReaderProxy.java:108)
	at io.github.classgraph.ClasspathElementModule.scanPaths(ClasspathElementModule.java:304)
	at io.github.classgraph.Scanner$4.processWorkUnit(Scanner.java:1091)
	at io.github.classgraph.Scanner$4.processWorkUnit(Scanner.java:1085)
	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 java.base@17.0.7/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base@17.0.7/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base@17.0.7/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base@17.0.7/java.lang.Thread.run(Thread.java:833)
	at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:807)
	at org.graalvm.nativeimage.builder/com.oracle.svm.core.posix.thread.PosixPlatformThreads.pthreadStartRoutine(PosixPlatformThreads.java:210)

@archenroot
Copy link

archenroot commented Dec 25, 2023

I hit this error today with the following, I have run agent lib few times with different configuration:
java -agentlib:native-image-agent=config-merge-dir=native-image-config/ -jar target/atlan-api-benchmark-1.0-SNAPSHOT-jar-with-dependencies.jar
Then I started generation of native-image

 zangetsu  X10SRA  …/atlan-api-benchmark  native-image --no-fallback -H:ConfigurationFileDirectories=native-image-config/ -jar target/atlan-api-benchmark-1.0-SNAPSHOT-jar-with-dependencies.jar 
========================================================================================================================
GraalVM Native Image: Generating 'atlan-api-benchmark-1.0-SNAPSHOT-jar-with-dependencies' (executable)...
========================================================================================================================
[1/8] Initializing...                                                                                    (6.6s @ 0.62GB)
 Java version: 21.0.1+12, vendor version: Oracle GraalVM 21.0.1+12.1
 Graal compiler: optimization level: 2, target machine: x86-64-v3, PGO: ML-inferred
 C compiler: gcc (linux, x86_64, 11.4.0)
 Garbage collector: Serial GC (max heap size: 80% of RAM)
 1 user-specific feature(s):
 - com.oracle.svm.thirdparty.gson.GsonFeature
------------------------------------------------------------------------------------------------------------------------
Build resources:
 - 26.49GB of memory (5.3% of 503.77GB system memory, determined at start)
 - 32 thread(s) (36.4% of 88 available processor(s), determined at start)
Found pending operations, continuing analysis.
[2/8] Performing analysis...  [****]                                                                    (18.8s @ 2.04GB)
    9,994 reachable types   (83.0% of   12,040 total)
   13,147 reachable fields  (43.6% of   30,172 total)
   44,484 reachable methods (32.1% of  138,634 total)
    3,890 types, 1,008 fields, and 3,905 methods registered for reflection
       59 types,    56 fields, and    53 methods registered for JNI access
        4 native libraries: dl, pthread, rt, z

Error: Unsupported features in 5 methods
Detailed message:
Error: Detected a ZipFile object in the image heap. A ZipFile object contains pointers to unmanaged C memory and file descriptors, and these resources are no longer available at image runtime. If these objects should not be stored in the image heap, you can use 

    '--trace-object-instantiation=java.util.jar.JarFile'

to find classes that instantiate these objects. Once you found such a class, you can mark it explicitly for run time initialization with 

    '--initialize-at-run-time=<culprit>'

to prevent the instantiation of the object.
The object was probably created by a class initializer and is reachable from a static field. You can request class initialization at image runtime by using the option --initialize-at-run-time=<class-name>. Or you can write your own initialization methods and call them explicitly from your main entry point.
Trace: Object was reached by
  reading field jdk.internal.module.ModuleReferences$JarModuleReader.jf of constant 
    jdk.internal.module.ModuleReferences$JarModuleReader@66de294b: jdk.internal.module.ModuleReferences$JarModuleReader@66de294b
  reading field java.util.concurrent.ConcurrentHashMap$Node.val of constant 
    java.util.concurrent.ConcurrentHashMap$Node@737b647c: [module org.graalvm.nativeimage.pointsto, location=file:///home/zangetsu/.sdkman...
  reading field java.util.concurrent.ConcurrentHashMap$Node.next of constant 
    java.util.concurrent.ConcurrentHashMap$Node@9ba9b6c: [module jdk.random, location=jrt:/jdk.random]=jdk.internal.module.SystemModuleFi...
  indexing into array java.util.concurrent.ConcurrentHashMap$Node[]@605fcb41: [Ljava.util.concurrent.ConcurrentHashMap$Node;@605fcb41
  reading field java.util.concurrent.ConcurrentHashMap.table of constant 
    java.util.concurrent.ConcurrentHashMap@602b7944: {[module jdk.internal.jvmstat, location=jrt:/jdk.internal.jvmstat]=jdk.internal....
  reading field jdk.internal.loader.BuiltinClassLoader.moduleToReader of constant 
    jdk.internal.loader.ClassLoaders$AppClassLoader@56cbfb61: jdk.internal.loader.ClassLoaders$AppClassLoader@56cbfb61
  reading field com.oracle.svm.core.hub.DynamicHubCompanion.classLoader of constant 
    com.oracle.svm.core.hub.DynamicHubCompanion@1f0cf61b: com.oracle.svm.core.hub.DynamicHubCompanion@1f0cf61b
  reading field java.lang.Class.companion of constant 
    java.lang.Class@62542914: interface com.atlan.model.assets.IAuthService
  manually triggered rescan
Error: Detected a ZipFile object in the image heap. A ZipFile object contains pointers to unmanaged C memory and file descriptors, and these resources are no longer available at image runtime. If these objects should not be stored in the image heap, you can use 

    '--trace-object-instantiation=java.util.jar.JarFile'

to find classes that instantiate these objects. Once you found such a class, you can mark it explicitly for run time initialization with 

    '--initialize-at-run-time=<culprit>'

to prevent the instantiation of the object.
The object was probably created by a class initializer and is reachable from a static field. You can request class initialization at image runtime by using the option --initialize-at-run-time=<class-name>. Or you can write your own initialization methods and call them explicitly from your main entry point.
Trace: Object was reached by
  reading field jdk.internal.module.ModuleReferences$JarModuleReader.jf of constant 
    jdk.internal.module.ModuleReferences$JarModuleReader@79e670d4: jdk.internal.module.ModuleReferences$JarModuleReader@79e670d4
  reading field java.util.concurrent.ConcurrentHashMap$Node.val of constant 
    java.util.concurrent.ConcurrentHashMap$Node@33a8086b: [module org.graalvm.nativeimage.builder, location=file:///home/zangetsu/.sdkman/...
  indexing into array java.util.concurrent.ConcurrentHashMap$Node[]@605fcb41: [Ljava.util.concurrent.ConcurrentHashMap$Node;@605fcb41
  reading field java.util.concurrent.ConcurrentHashMap.table of constant 
    java.util.concurrent.ConcurrentHashMap@602b7944: {[module jdk.internal.jvmstat, location=jrt:/jdk.internal.jvmstat]=jdk.internal....
  reading field jdk.internal.loader.BuiltinClassLoader.moduleToReader of constant 
    jdk.internal.loader.ClassLoaders$AppClassLoader@56cbfb61: jdk.internal.loader.ClassLoaders$AppClassLoader@56cbfb61
  reading field com.oracle.svm.core.hub.DynamicHubCompanion.classLoader of constant 
    com.oracle.svm.core.hub.DynamicHubCompanion@1f0cf61b: com.oracle.svm.core.hub.DynamicHubCompanion@1f0cf61b
  reading field java.lang.Class.companion of constant 
    java.lang.Class@62542914: interface com.atlan.model.assets.IAuthService
  manually triggered rescan
Error: Detected a ZipFile object in the image heap. A ZipFile object contains pointers to unmanaged C memory and file descriptors, and these resources are no longer available at image runtime. If these objects should not be stored in the image heap, you can use 

    '--trace-object-instantiation=java.util.jar.JarFile'

to find classes that instantiate these objects. Once you found such a class, you can mark it explicitly for run time initialization with 

    '--initialize-at-run-time=<culprit>'

to prevent the instantiation of the object.
The object was probably created by a class initializer and is reachable from a static field. You can request class initialization at image runtime by using the option --initialize-at-run-time=<class-name>. Or you can write your own initialization methods and call them explicitly from your main entry point.
Trace: Object was reached by
  reading field jdk.internal.module.ModuleReferences$JarModuleReader.jf of constant 
    jdk.internal.module.ModuleReferences$JarModuleReader@7aa7b6b3: jdk.internal.module.ModuleReferences$JarModuleReader@7aa7b6b3
  reading field java.util.concurrent.ConcurrentHashMap$Node.val of constant 
    java.util.concurrent.ConcurrentHashMap$Node@1f6b53cd: [module org.graalvm.nativeimage.objectfile, location=file:///home/zangetsu/.sdkm...
  indexing into array java.util.concurrent.ConcurrentHashMap$Node[]@605fcb41: [Ljava.util.concurrent.ConcurrentHashMap$Node;@605fcb41
  reading field java.util.concurrent.ConcurrentHashMap.table of constant 
    java.util.concurrent.ConcurrentHashMap@602b7944: {[module jdk.internal.jvmstat, location=jrt:/jdk.internal.jvmstat]=jdk.internal....
  reading field jdk.internal.loader.BuiltinClassLoader.moduleToReader of constant 
    jdk.internal.loader.ClassLoaders$AppClassLoader@56cbfb61: jdk.internal.loader.ClassLoaders$AppClassLoader@56cbfb61
  reading field com.oracle.svm.core.hub.DynamicHubCompanion.classLoader of constant 
    com.oracle.svm.core.hub.DynamicHubCompanion@1f0cf61b: com.oracle.svm.core.hub.DynamicHubCompanion@1f0cf61b
  reading field java.lang.Class.companion of constant 
    java.lang.Class@62542914: interface com.atlan.model.assets.IAuthService
  manually triggered rescan
Error: Detected a ZipFile object in the image heap. A ZipFile object contains pointers to unmanaged C memory and file descriptors, and these resources are no longer available at image runtime. If these objects should not be stored in the image heap, you can use 

    '--trace-object-instantiation=java.util.jar.JarFile'

to find classes that instantiate these objects. Once you found such a class, you can mark it explicitly for run time initialization with 

    '--initialize-at-run-time=<culprit>'

to prevent the instantiation of the object.
The object was probably created by a class initializer and is reachable from a static field. You can request class initialization at image runtime by using the option --initialize-at-run-time=<class-name>. Or you can write your own initialization methods and call them explicitly from your main entry point.
Trace: Object was reached by
  reading field jdk.internal.module.ModuleReferences$JarModuleReader.jf of constant 
    jdk.internal.module.ModuleReferences$JarModuleReader@c81a02d: jdk.internal.module.ModuleReferences$JarModuleReader@c81a02d
  reading field java.util.concurrent.ConcurrentHashMap$Node.val of constant 
    java.util.concurrent.ConcurrentHashMap$Node@4aa454d7: [module org.graalvm.nativeimage.base, location=file:///home/zangetsu/.sdkman/can...
  indexing into array java.util.concurrent.ConcurrentHashMap$Node[]@605fcb41: [Ljava.util.concurrent.ConcurrentHashMap$Node;@605fcb41
  reading field java.util.concurrent.ConcurrentHashMap.table of constant 
    java.util.concurrent.ConcurrentHashMap@602b7944: {[module jdk.internal.jvmstat, location=jrt:/jdk.internal.jvmstat]=jdk.internal....
  reading field jdk.internal.loader.BuiltinClassLoader.moduleToReader of constant 
    jdk.internal.loader.ClassLoaders$AppClassLoader@56cbfb61: jdk.internal.loader.ClassLoaders$AppClassLoader@56cbfb61
  reading field com.oracle.svm.core.hub.DynamicHubCompanion.classLoader of constant 
    com.oracle.svm.core.hub.DynamicHubCompanion@1f0cf61b: com.oracle.svm.core.hub.DynamicHubCompanion@1f0cf61b
  reading field java.lang.Class.companion of constant 
    java.lang.Class@62542914: interface com.atlan.model.assets.IAuthService
  manually triggered rescan
Error: Detected a ZipFile object in the image heap. A ZipFile object contains pointers to unmanaged C memory and file descriptors, and these resources are no longer available at image runtime. If these objects should not be stored in the image heap, you can use 

    '--trace-object-instantiation=java.util.jar.JarFile'

to find classes that instantiate these objects. Once you found such a class, you can mark it explicitly for run time initialization with 

    '--initialize-at-run-time=<culprit>'

to prevent the instantiation of the object.
The object was probably created by a class initializer and is reachable from a static field. You can request class initialization at image runtime by using the option --initialize-at-run-time=<class-name>. Or you can write your own initialization methods and call them explicitly from your main entry point.
Trace: Object was reached by
  reading field jdk.internal.module.ModuleReferences$JarModuleReader.jf of constant 
    jdk.internal.module.ModuleReferences$JarModuleReader@7ebe4f76: jdk.internal.module.ModuleReferences$JarModuleReader@7ebe4f76
  reading field java.util.concurrent.ConcurrentHashMap$Node.val of constant 
    java.util.concurrent.ConcurrentHashMap$Node@6fbb2e89: [module com.oracle.svm.svm_enterprise, location=file:///home/zangetsu/.sdkman/ca...
  indexing into array java.util.concurrent.ConcurrentHashMap$Node[]@605fcb41: [Ljava.util.concurrent.ConcurrentHashMap$Node;@605fcb41
  reading field java.util.concurrent.ConcurrentHashMap.table of constant 
    java.util.concurrent.ConcurrentHashMap@602b7944: {[module jdk.internal.jvmstat, location=jrt:/jdk.internal.jvmstat]=jdk.internal....
  reading field jdk.internal.loader.BuiltinClassLoader.moduleToReader of constant 
    jdk.internal.loader.ClassLoaders$AppClassLoader@56cbfb61: jdk.internal.loader.ClassLoaders$AppClassLoader@56cbfb61
  reading field com.oracle.svm.core.hub.DynamicHubCompanion.classLoader of constant 
    com.oracle.svm.core.hub.DynamicHubCompanion@1f0cf61b: com.oracle.svm.core.hub.DynamicHubCompanion@1f0cf61b
  reading field java.lang.Class.companion of constant 
    java.lang.Class@62542914: interface com.atlan.model.assets.IAuthService
  manually triggered rescan

------------------------------------------------------------------------------------------------------------------------
                        1.4s (5.4% of total time) in 19 GCs | Peak RSS: 3.49GB | CPU load: 13.53
========================================================================================================================
Finished generating 'atlan-api-benchmark-1.0-SNAPSHOT-jar-with-dependencies' in 25.7s.

Than I removed from reflect-config.json following entries:

{
  "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
},

And the error disappeared.

But running the binary throw exception:

Exception in thread "main" java.lang.ExceptionInInitializerError
	at com.atlan.AtlanClient.<init>(AtlanClient.java:178)
	at com.atlan.Atlan.getClient(Atlan.java:63)
	at com.atlan.Atlan.getClient(Atlan.java:42)
	at com.atlan.Atlan.setBaseUrl(Atlan.java:102)
	at net.pmi.atlan.api.benchmark.AtlanApiBenchmark.<clinit>(AtlanApiBenchmark.java:52)
	at java.base@21.0.1/java.lang.invoke.DirectMethodHandle.ensureInitialized(DirectMethodHandle.java:288)
	at java.base@21.0.1/java.lang.invoke.DirectMethodHandle.internalMemberNameEnsureInit(DirectMethodHandle.java:336)
Caused by: 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.atlan.serde.Serde.<clinit>(Serde.java:52)
	... 7 more
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 java.base@21.0.1/java.util.concurrent.FutureTask.run(FutureTask.java:317)
	at java.base@21.0.1/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base@21.0.1/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base@21.0.1/java.lang.Thread.runWith(Thread.java:1596)
	at java.base@21.0.1/java.lang.Thread.run(Thread.java:1583)
	at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:832)
	at org.graalvm.nativeimage.builder/com.oracle.svm.core.posix.thread.PosixPlatformThreads.pthreadStartRoutine(PosixPlatformThreads.java:211)
Caused by: java.lang.reflect.InvocationTargetException
	at java.base@21.0.1/java.lang.reflect.Method.invoke(Method.java:580)
	at nonapi.io.github.classgraph.reflection.StandardReflectionDriver.invokeMethod(StandardReflectionDriver.java:193)
	at nonapi.io.github.classgraph.reflection.ReflectionUtils.invokeMethod(ReflectionUtils.java:227)
	... 15 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:121)
	at java.base@21.0.1/jdk.internal.module.SystemModuleFinders$SystemImage.reader(SystemModuleFinders.java:158)
	at java.base@21.0.1/jdk.internal.module.SystemModuleFinders$ModuleContentSpliterator.<init>(SystemModuleFinders.java:527)
	at java.base@21.0.1/jdk.internal.module.SystemModuleFinders$SystemModuleReader.list(SystemModuleFinders.java:502)
	... 18 more

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