lukasz-antoniak commented on PR #2059:
URL: 
https://github.com/apache/cassandra-java-driver/pull/2059#issuecomment-4010999984

   @absurdfarce: Are you building Quarkus with GraalVM 25?
   
   The issue seems that 
`com.datastax.oss.driver.shaded.guava.common.primitives.LexicographicalComparatorHolderSubstitution`
 is being initialized at build time, and references 
`UnsignedBytes.LexicographicalComparatorHolder.PureJavaComparator` which is not 
initialized at build time (comes from shaded Guava, but not from source 
folder). `LexicographicalComparatorHolderSubstitution` is our class that is 
part of shaded Guava JAR in the end, but it is present in source directory.
   
   For reference, below is the error message I get when building the example 
application without proposed fix:
   
   ```
   Fatal error: 
com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: An object of 
type 
'com.datastax.oss.driver.shaded.guava.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$PureJavaComparator'
 was found in the image heap. This type, however, is marked for initialization 
at image run time for the following reason: classes are initialized at run time 
by default.
   This is not allowed for correctness reasons: All objects that are stored in 
the image heap must be initialized at build time.
   
   You now have two options to resolve this:
   
   1) If it is intended that objects of type 
'com.datastax.oss.driver.shaded.guava.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$PureJavaComparator'
 are persisted in the image heap, add 
   
       
'--initialize-at-build-time=com.datastax.oss.driver.shaded.guava.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$PureJavaComparator'
   
   to the native-image arguments. Note that initializing new types can store 
additional objects to the heap. It is advised to check the static fields of 
'com.datastax.oss.driver.shaded.guava.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$PureJavaComparator'
 to see if they are safe for build-time initialization,  and that they do not 
contain any sensitive data that should not become part of the image.
   
   2) If it is not intended that objects of type 
'com.datastax.oss.driver.shaded.guava.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$PureJavaComparator'
 are persisted in the image heap, examine the stack trace and use 
   
       
'--initialize-at-run-time=com.datastax.oss.driver.shaded.guava.common.primitives.LexicographicalComparatorHolderSubstitution'
   
   to prevent instantiation of the culprit object.
   The culprit object has been instantiated by the 
'com.datastax.oss.driver.shaded.guava.common.primitives.LexicographicalComparatorHolderSubstitution'
 class initializer with the following trace:
           at 
com.datastax.oss.driver.shaded.guava.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$PureJavaComparator.<init>(UnsignedBytes.java:417)
           at 
com.datastax.oss.driver.shaded.guava.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$PureJavaComparator.<clinit>(UnsignedBytes.java:418)
           at 
com.datastax.oss.driver.shaded.guava.common.primitives.UnsignedBytes.lexicographicalComparatorJavaImpl(UnsignedBytes.java:279)
           at 
com.datastax.oss.driver.shaded.guava.common.primitives.LexicographicalComparatorHolderSubstitution.<clinit>(LexicographicalComparatorHolderSubstitution.java:31)
   
   If you are seeing this message after upgrading to a new GraalVM release, 
this means that some objects ended up in the image heap without their type 
being marked with --initialize-at-build-time.
   To fix this, include 
'--initialize-at-build-time=com.datastax.oss.driver.shaded.guava.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$PureJavaComparator'
 in your configuration. If the classes do not originate from your code, it is 
advised to update all library or framework dependencies to the latest version 
before addressing this error.
   
   The following detailed trace displays from which field in the code the 
object was reached.
   Object was reached by
     reading static field 
com.datastax.oss.driver.shaded.guava.common.primitives.UnsignedBytes$LexicographicalComparatorHolder.BEST_COMPARATOR
       at 
com.datastax.oss.driver.shaded.guava.common.primitives.UnsignedBytes.lexicographicalComparator(UnsignedBytes.java:274)
     parsing method 
com.datastax.oss.driver.shaded.guava.common.primitives.UnsignedBytes.lexicographicalComparator(UnsignedBytes.java:274)
 reachable via the parsing context
       at 
com.datastax.oss.driver.internal.core.metadata.token.ByteOrderedToken.compareTo(ByteOrderedToken.java:64)
       at 
com.datastax.oss.driver.internal.core.metadata.token.ByteOrderedToken.compareTo(ByteOrderedToken.java:29)
       at java.util.TreeMap.put(TreeMap.java:848)
       at 
com.oracle.svm.core.code.FactoryMethodHolder.LocaleExtensions_OLKh1W5hrPDlwtlgvsFehG(generated:0)
       at 
sun.util.locale.InternalLocaleBuilder.getLocaleExtensions(InternalLocaleBuilder.java:533)
       at java.util.Locale.getDefaultExtensions(Locale.java:1181)
       at java.util.Locale.initDefault(Locale.java:1157)
       at 
com.oracle.svm.core.jdk.localization.substitutions.Target_java_util_Locale$DefaultLocaleAccessors.get(Target_java_util_Locale.java:51)
       at java.util.Locale.initDefault(Locale.java:1162)
       at java.util.Locale.getDisplayLocale(Locale.java:1137)
       at java.util.Locale.getDefault(Locale.java:1121)
       at 
com.oracle.svm.core.code.FactoryMethodHolder.Formatter_dUcv0u89qA5jjO5C6NRf2B(generated:0)
       at com.oracle.svm.enterprise.core.stringformat.a.a(stripped:252)
       at com.oracle.svm.enterprise.core.stringformat.a.a(stripped:137)
       at 
org.springframework.boot.logging.CorrelationIdFormatter.of(CorrelationIdFormatter.java:138)
       at 
org.springframework.boot.logging.CorrelationIdFormatter.<clinit>(CorrelationIdFormatter.java:73)
       at static root method.(Unknown Source)
   
           at 
org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.onObjectReachable(ImageHeapScanner.java:618)
           at 
org.graalvm.nativeimage.builder/com.oracle.svm.hosted.heap.SVMImageHeapScanner.onObjectReachable(SVMImageHeapScanner.java:127)
           at 
org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.lambda$markReachable$0(ImageHeapScanner.java:589)
           at 
org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.CompletionExecutor.executeCommand(CompletionExecutor.java:166)
           at 
org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.CompletionExecutor.lambda$executeService$0(CompletionExecutor.java:152)
           at 
java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.compute(ForkJoinTask.java:1750)
           at 
java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.compute(ForkJoinTask.java:1742)
           at 
java.base/java.util.concurrent.ForkJoinTask$InterruptibleTask.exec(ForkJoinTask.java:1659)
           at 
java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:511)
           at 
java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1450)
           at 
java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:2019)
           at 
java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:187)
   Caused by: 
com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: An object of 
type 
'com.datastax.oss.driver.shaded.guava.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$PureJavaComparator'
 was found in the image heap. This type, however, is marked for initialization 
at image run time for the following reason: classes are initialized at run time 
by default.
   This is not allowed for correctness reasons: All objects that are stored in 
the image heap must be initialized at build time.
   
   You now have two options to resolve this:
   
   1) If it is intended that objects of type 
'com.datastax.oss.driver.shaded.guava.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$PureJavaComparator'
 are persisted in the image heap, add 
   
       
'--initialize-at-build-time=com.datastax.oss.driver.shaded.guava.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$PureJavaComparator'
   
   to the native-image arguments. Note that initializing new types can store 
additional objects to the heap. It is advised to check the static fields of 
'com.datastax.oss.driver.shaded.guava.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$PureJavaComparator'
 to see if they are safe for build-time initialization,  and that they do not 
contain any sensitive data that should not become part of the image.
   
   2) If it is not intended that objects of type 
'com.datastax.oss.driver.shaded.guava.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$PureJavaComparator'
 are persisted in the image heap, examine the stack trace and use 
   
       
'--initialize-at-run-time=com.datastax.oss.driver.shaded.guava.common.primitives.LexicographicalComparatorHolderSubstitution'
   
   to prevent instantiation of the culprit object.
   The culprit object has been instantiated by the 
'com.datastax.oss.driver.shaded.guava.common.primitives.LexicographicalComparatorHolderSubstitution'
 class initializer with the following trace:
           at 
com.datastax.oss.driver.shaded.guava.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$PureJavaComparator.<init>(UnsignedBytes.java:417)
           at 
com.datastax.oss.driver.shaded.guava.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$PureJavaComparator.<clinit>(UnsignedBytes.java:418)
           at 
com.datastax.oss.driver.shaded.guava.common.primitives.UnsignedBytes.lexicographicalComparatorJavaImpl(UnsignedBytes.java:279)
           at 
com.datastax.oss.driver.shaded.guava.common.primitives.LexicographicalComparatorHolderSubstitution.<clinit>(LexicographicalComparatorHolderSubstitution.java:31)
   
   If you are seeing this message after upgrading to a new GraalVM release, 
this means that some objects ended up in the image heap without their type 
being marked with --initialize-at-build-time.
   To fix this, include 
'--initialize-at-build-time=com.datastax.oss.driver.shaded.guava.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$PureJavaComparator'
 in your configuration. If the classes do not originate from your code, it is 
advised to update all library or framework dependencies to the latest version 
before addressing this error.
   
   The following detailed trace displays from which field in the code the 
object was reached.
           at 
org.graalvm.nativeimage.builder/com.oracle.svm.hosted.classinitialization.ClassInitializationFeature.checkImageHeapInstance(ClassInitializationFeature.java:205)
           at 
org.graalvm.nativeimage.builder/com.oracle.svm.hosted.SVMHost.validateReachableObject(SVMHost.java:371)
           at 
org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.onObjectReachable(ImageHeapScanner.java:607)
           ... 11 more
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to