我对 JVM 和 ClassLoaders 还很陌生。我有这两个类:
public abstract class CoreModule extends Entity
public final class EventManager extends CoreModule
在程序开始时,我创建了一个EventManager. 所以我知道JVM知道什么是Entity类以及如何加载它(也就是说,它知道ClassLoader要使用什么),因为EventManager它是一个孙子。但是当一个Entity实例通过某种序列化机制传递时,它会抛出ClassNotFoundException. 我必须手动设置ClassLoader使用(Event.class.getClassLoader())。
JVM 怎么会不知道什么是Event类,或者如果它已经完成了如何加载它?