I have an ObjectInputStream and want to load classes with a custom ClassLoader.
Thus is created a subclass of ObjectInputStream that overrides the resolveClass() function.
Now my problem is that i want to change the ClassLoader during execution. But sometimes resolveClass() does not seem to be executed when I do readObject()on this stream. Then the class is loaded with the wrong ClassLoader.
Any idea why resolveClass() is not executed and how to solve this issue?
resolveClass() will be called once per class descriptor in the stream. I have no idea what would happen if you wrote multiple descriptors for the same full qualified class name - probably unspecified. The correct solution would be to use multiple streams (could be nested within one another).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With