Java classloaders: why search the parent classloader first?
问题 The correct behaviour for a classloader in Java is to: If it has already been loaded, return the class Call the parent loadClass() Try and load the class itself. So the class defined in the system classpath should always get loaded first. Tomcat defines classloader per war, which has the system classloader as a parent, so if you try to load a class, it will first look in the system classpath and then in the classpath defined in the war file. As per my understanding, this is for two reasons: