I'm fairly new to the JVM and ClassLoaders. I have these two classes:
public abstract class CoreModule extends Entity
public final class EventManager extends CoreModule
At the start of the program, I create an instance of EventManager
. So I understand that the JVM knows what Entity
class is and how to load it (that is, it knows what ClassLoader
to use), since EventManager
is a grand-child. But when an Entity
instance is passed by some serialization mechanism, it throws ClassNotFoundException
. I have to manually set the ClassLoader
to use (Event.class.getClassLoader()
).
How come the JVM does not know what Event
class is or how to load it if it already did it?