Closed melloware closed 1 month ago
I thought about this some more and I'm not sure if we should really go in this direction:
This would fix your issue, but at a cost. Assuming that Kryo's default class loader can never load your classes, you will get an exception for every class that you load, every time you deserialize an object graph. And you wouldn't notice because everything works as expected. If your object graph is complex and contains a large number of classes, this could result in significant overhead because throwing exceptions is expensive.
I don't disagree with that. I didn't look what is kryo's default classloader and should it be Thread.currentThread().getContextClassLoader()
?
The default classloader is defined in Kryo.java as:
private ClassLoader classLoader = getClass().getClassLoader();
This default works fine in most environments and you are the first user to raise a class loading issue in years. So I'd say that your use-case is a bit special and there already is a solution that you can use to configure Kryo accordingly.
Given my concerns mentioned above, I tend to keep things as they are now.
Fix #1145: Attempt Thread.currentThread().getContextClassLoader()