dennishendriksen opened a new issue, #2635:
URL: https://github.com/apache/fory/issues/2635

   ### Question
   
   I'm struggling with an error using my graalvm 25 native image with fory 
v0.12.2.
   
   any thoughts on how to debug this issue?
   ```
   error: Failed to deserialize input
   org.apache.fory.exception.DeserializationException: Failed to deserialize 
input
           at 
org.apache.fory.util.ExceptionUtils.handleReadFailed(ExceptionUtils.java:66)
           at org.apache.fory.Fory.deserializeJavaObject(Fory.java:1226)
           <cut>
           at 
java.base@25/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)
   Caused by: java.lang.RuntimeException: java.lang.NoSuchMethodException: 
org.molgenis.vipannotate.annotation.SequenceVariantAnnotationIndexBig.<init>([Ljava.math.BigInteger;)
           at 
org.apache.fory.util.record.RecordUtils$3.computeValue(RecordUtils.java:142)
           at 
org.apache.fory.util.record.RecordUtils$3.computeValue(RecordUtils.java:129)
           at 
java.base@25/java.lang.ClassValue.get(JavaLangSubstitutions.java:542)
           at 
org.apache.fory.util.record.RecordUtils.getRecordConstructor(RecordUtils.java:198)
           <cut>
           at 
org.apache.fory.serializer.Serializers.newSerializer(Serializers.java:101)
           at 
org.apache.fory.resolver.ClassResolver.createSerializer(ClassResolver.java:1402)
           at 
org.apache.fory.resolver.ClassResolver.getClassInfo(ClassResolver.java:1276)
           at org.apache.fory.Fory.deserializeJavaObject(Fory.java:1218)
           ... 9 more
   Caused by: java.lang.NoSuchMethodException: 
org.molgenis.vipannotate.annotation.SequenceVariantAnnotationIndexBig.<init>([Ljava.math.BigInteger;)
           at 
java.base@25/java.lang.Class.checkConstructor(DynamicHub.java:1356)
           at java.base@25/java.lang.Class.getConstructor0(DynamicHub.java:1565)
           at 
java.base@25/java.lang.Class.getDeclaredConstructor(DynamicHub.java:2491)
           at 
org.apache.fory.util.record.RecordUtils$3.computeValue(RecordUtils.java:140)
           ... 33 more
   class in question:
   public record SequenceVariantAnnotationIndexBig(BigInteger[] 
encodedVariants) {
     public @Nullable IndexRange findIndex(SequenceVariant variant) {
       BigInteger encodedVariant = SequenceVariantEncoder.encodeBig(variant);
       return IndexRangeFinder.findIndexes(encodedVariants, encodedVariant);
     }
   }
   ```
   
   I've followed https://fory.apache.org/docs/guide/graalvm_guide/ (not 
thread-safe Fory):
   ```
   public class ForyFactory {
     private static final Fory fory;
   
     static {
       fory = 
Fory.builder().withLanguage(Language.JAVA).requireClassRegistration(true).registerGuavaTypes(false).build();
       fory.registerSerializer(SortedIntArrayWrapper.class, 
SortedIntArrayWrapperSerializer.class);
       fory.register(SequenceVariantAnnotationIndexSmall.class, true);
       fory.register(SequenceVariantAnnotationIndexBig.class, true);
       fory.register(SequenceVariantAnnotationIndex.class, true);
       fory.ensureSerializersCompiled();
     }
   
     private ForyFactory() {}
   
     public static Fory createFory() {
       return fory;
     }
   }
   ```
   
   native-image.properties:
   ```
   $ cat 
src/main/resources/META-INF/native-image/org.molgenis/vip-annotate/native-image.properties
   Args=--initialize-at-build-time=org.molgenis.vipannotate.serialization,\
       me.lemire.integercompression,\
       org.molgenis.vipannotate.annotation.SequenceVariantAnnotationIndexBig,\
       org.molgenis.vipannotate.annotation.SequenceVariantAnnotationIndexSmall,\
       org.molgenis.vipannotate.annotation.SequenceVariantAnnotationIndex
   ```
   
   build shows some warnings, might this be relevant?
   ```
   [1/8] Initializing...WARNING: A terminally deprecated method in 
sun.misc.Unsafe has been called
   WARNING: sun.misc.Unsafe::arrayBaseOffset has been called by 
org.apache.fory.memory.Platform 
(file:/home/dhendriksen/.m2/repository/org/apache/fory/fory-core/0.12.2/fory-core-0.12.2.jar)
   WARNING: Please consider reporting this to the maintainers of class 
org.apache.fory.memory.Platform
   WARNING: sun.misc.Unsafe::arrayBaseOffset will be removed in a future release
   Warning: Unknown attribute(s) [methods, fields] in serialization descriptor 
object
   Warning: "customTargetConstructorClass" is deprecated in 
serialization-config.json. All serializable classes can be instantiated through 
any superclass constructor without the use of the flag.
   Build resources:
   2025-09-19 06:17:10 INFO  Fory:172 [ForkJoinPool.commonPool-worker-1] - 
Created new fory org.apache.fory.Fory@7ae10962
   <cut>
   2025-09-19 06:17:10 INFO  CompileUnit:55 [ForkJoinPool.commonPool-worker-1] 
- Generate code for 
org.molgenis.vipannotate.annotation.SequenceVariantAnnotationIndexBigForyCodec_0
 took 14 ms.
   2025-09-19 06:17:10 INFO  JaninoUtils:121 [ForkJoinPool.commonPool-worker-1] 
- Compile [SequenceVariantAnnotationIndexBigForyCodec_0] take 23 ms
   <cut>
   2025-09-19 06:17:10 INFO  JaninoUtils:121 [ForkJoinPool.commonPool-worker-1] 
- Compile [SerializedLambdaForyCodec_0] take 76 ms
   2025-09-19 06:17:10 WARN  ObjectStreamSerializer:93 
[ForkJoinPool.commonPool-worker-1] - class java.lang.IndexOutOfBoundsException 
customized jdk serialization, which is inefficient. Please replace it with a 
org.apache.fory.serializer.Serializer or implements java.io.Externalizable
   <cut>
   2025-09-19 06:17:10 INFO  JaninoUtils:121 [ForkJoinPool.commonPool-worker-1] 
- Compile [ThrowableForyCodecCompatible_0] take 61 ms
   2025-09-19 06:17:10 WARN  ObjectStreamSerializer:93 
[ForkJoinPool.commonPool-worker-1] - class java.lang.Throwable customized jdk 
serialization, which is inefficient. Please replace it with a 
org.apache.fory.serializer.Serializer or implements java.io.Externalizable
   2025-09-19 06:17:10 WARN  ObjectStreamSerializer:93 
[ForkJoinPool.commonPool-worker-1] - class java.lang.NullPointerException 
customized jdk serialization, which is inefficient. Please replace it with a 
org.apache.fory.serializer.Serializer or implements java.io.Externalizable
   <cut>
   2025-09-19 06:17:10 INFO  JaninoUtils:121 [ForkJoinPool.commonPool-worker-1] 
- Compile [Collections_ReverseComparatorForyCodec_0] take 7 ms
   2025-09-19 06:17:10 WARN  ObjectStreamSerializer:93 
[ForkJoinPool.commonPool-worker-1] - class 
java.util.concurrent.LinkedBlockingQueue customized jdk serialization, which is 
inefficient. Please replace it with a org.apache.fory.serializer.Serializer or 
implements java.io.Externalizable
   <cut>
   2025-09-19 06:17:10 INFO  JaninoUtils:121 [ForkJoinPool.commonPool-worker-1] 
- Compile [StackTraceElementForyCodec_0] take 25 ms
   2025-09-19 06:17:10 WARN  ObjectStreamSerializer:93 
[ForkJoinPool.commonPool-worker-1] - class java.lang.Exception customized jdk 
serialization, which is inefficient. Please replace it with a 
org.apache.fory.serializer.Serializer or implements java.io.Externalizable
   2025-09-19 06:17:10 WARN  ObjectStreamSerializer:93 
[ForkJoinPool.commonPool-worker-1] - class java.lang.RuntimeException 
customized jdk serialization, which is inefficient. Please replace it with a 
org.apache.fory.serializer.Serializer or implements java.io.Externalizable
   2025-09-19 06:17:10 WARN  ObjectStreamSerializer:93 
[ForkJoinPool.commonPool-worker-1] - class java.lang.IllegalArgumentException 
customized jdk serialization, which is inefficient. Please replace it with a 
org.apache.fory.serializer.Serializer or implements java.io.Externalizable
   <cut>
   2025-09-19 06:17:10 INFO  JaninoUtils:121 [ForkJoinPool.commonPool-worker-1] 
- Compile [IllegalArgumentExceptionForyCodecCompatible_0] take 10 ms
   2025-09-19 06:17:10 WARN  ObjectStreamSerializer:93 
[ForkJoinPool.commonPool-worker-1] - class 
java.util.concurrent.ArrayBlockingQueue customized jdk serialization, which is 
inefficient. Please replace it with a org.apache.fory.serializer.Serializer or 
implements java.io.Externalizable
   <cut>
   2025-09-19 06:17:11 INFO  JaninoUtils:121 [ForkJoinPool.commonPool-worker-1] 
- Compile [ArrayBlockingQueueForyCodecCompatible_0] take 63 ms
   2025-09-19 06:17:11 WARN  ObjectStreamSerializer:93 
[ForkJoinPool.commonPool-worker-1] - class java.lang.IllegalStateException 
customized jdk serialization, which is inefficient. Please replace it with a 
org.apache.fory.serializer.Serializer or implements java.io.Externalizable
   <cut>
   2025-09-19 06:17:11 INFO  JaninoUtils:121 [ForkJoinPool.commonPool-worker-1] 
- Compile [IllegalStateExceptionForyCodecCompatible_0] take 16 ms
   2025-09-19 06:17:11 WARN  ObjectStreamSerializer:93 
[ForkJoinPool.commonPool-worker-1] - class java.io.IOException customized jdk 
serialization, which is inefficient. Please replace it with a 
org.apache.fory.serializer.Serializer or implements java.io.Externalizable
   <cut>
   2025-09-19 06:17:11 INFO  JaninoUtils:121 [ForkJoinPool.commonPool-worker-1] 
- Compile [IOExceptionForyCodecCompatible_0] take 29 ms
   2025-09-19 06:17:11 WARN  ObjectStreamSerializer:93 
[ForkJoinPool.commonPool-worker-1] - class 
java.lang.ArrayIndexOutOfBoundsException customized jdk serialization, which is 
inefficient. Please replace it with a org.apache.fory.serializer.Serializer or 
implements java.io.Externalizable
   <cut>
   ```
   any of your thoughts are highly appreciated!


-- 
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