You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fury.apache.org by "cquezel (via GitHub)" <gi...@apache.org> on 2025/02/28 17:53:34 UTC

[I] java.lang.ClassCastException while serializing a complex Java object [fury]

cquezel opened a new issue, #2085:
URL: https://github.com/apache/fury/issues/2085

   ### Search before asking
   
   - [x] I had searched in the [issues](https://github.com/apache/fury/issues) and found no similar issues.
   
   
   ### Version
   
   Fury 0.10.0 
   Open JDK 21
   Windows 
   
   ### Component(s)
   
   Java
   
   ### Minimal reproduce step
   
   I am very sorry but I cannot reproduce this using a simple unit test. It is a long data import process which is ultimately serialized in a 1,2 GB object on disk. I hope the stack trace can provide a sufficient hint at the problem.
   
   This is the Fury code 
   
   	private static <T> void écrireFury(FileOutputStream fos, T objet) throws IOException {
   		Fury fury = Fury.builder().withLanguage(Language.JAVA)
   			.requireClassRegistration(false)
   			.withRefTracking(true)
   			.build();
   		byte[] bytes = fury.serialize(objet);		
   		fos.write(bytes);
   	}
   
   To replace the Java:
   
   	private static <T> void écrireJava(FileOutputStream fos, T objet) throws FileNotFoundException, IOException {
   		try (ObjectOutput oos = new ObjectOutputStream(fos)) {
   			oos.writeObject(objet);
   		}
   	}
   
   
   ### What did you expect to see?
   
   A successful serialization to disk.
   
   ### What did you see instead?
   
   
   Caused by: java.lang.ClassCastException: class myproject.modelecompletimpl.GroupeRéguliersImpl cannot be cast to class myproject.modelecompletimpl.ModuleImpl (myproject.modelecompletimpl.GroupeRéguliersImpl and myproject.modelecompletimpl.ModuleImpl are in module myproject.modelecompletimpl of loader 'app')
   	at myproject.modelecompletimpl.ModuleImplFuryRefCodec_0.write(ModuleImplFuryRefCodec_0.java:1743) ~[?:?]
   	at myproject.modelecompletimpl.NoeudsQuiFontRéférenceAuCatalogueImplFuryRefCodec_0.writeChunk$(NoeudsQuiFontRéférenceAuCatalogueImplFuryRefCodec_0.java:193) ~[?:?]
   	at myproject.modelecompletimpl.NoeudsQuiFontRéférenceAuCatalogueImplFuryRefCodec_0.writeFields1$(NoeudsQuiFontRéférenceAuCatalogueImplFuryRefCodec_0.java:228) ~[?:?]
   	at myproject.modelecompletimpl.NoeudsQuiFontRéférenceAuCatalogueImplFuryRefCodec_0.write(NoeudsQuiFontRéférenceAuCatalogueImplFuryRefCodec_0.java:463) ~[?:?]
   	at org.apache.fury.core@0.10.0/org.apache.fury.Fury.writeNonRef(Fury.java:479) ~[fury-core-0.10.0.jar:?]
   	at org.apache.fury.core@0.10.0/org.apache.fury.serializer.ArraySerializers$ObjectArraySerializer.write(ArraySerializers.java:106) ~[fury-core-0.10.0.jar:?]
   	at org.apache.fury.core@0.10.0/org.apache.fury.serializer.ArraySerializers$ObjectArraySerializer.write(ArraySerializers.java:43) ~[fury-core-0.10.0.jar:?]
   	... a thousand more lines
   
   ### Anything Else?
   
   _No response_
   
   ### Are you willing to submit a PR?
   
   - [ ] I'm willing to submit a PR!


-- 
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: commits-unsubscribe@fury.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org
For additional commands, e-mail: commits-help@fury.apache.org


Re: [I] java.lang.ClassCastException while serializing a complex Java object [fory]

Posted by "chaokunyang (via GitHub)" <gi...@apache.org>.
chaokunyang closed issue #2085: java.lang.ClassCastException while serializing a complex Java object
URL: https://github.com/apache/fory/issues/2085


-- 
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: commits-unsubscribe@fory.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org
For additional commands, e-mail: commits-help@fory.apache.org


Re: [I] java.lang.ClassCastException while serializing a complex Java object [fory]

Posted by "chaokunyang (via GitHub)" <gi...@apache.org>.
chaokunyang commented on issue #2085:
URL: https://github.com/apache/fory/issues/2085#issuecomment-3749174750

   Please reopen it if it can be reproduced at fory 0.14.1


-- 
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: commits-unsubscribe@fory.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org
For additional commands, e-mail: commits-help@fory.apache.org