source : Interesting comment in Mutant World
Did you ever wonder why you need to call Class.forName() to load JDBC driver but don’t have to for JNDI, which appeared in Java 2 at the same time when Context Classloader was introduced?
Here is the answer. When a classloader loads classes, it asks the parent classloader to load, only if the class is not available, it tries to load it.
In the case of API, such as JNDI, the parent classloader usualy can load JNDI classes, but only child classloader can load JNDI implementation, such as J2EE server client library.
So, standard classloading mechanism doesn’t work. That is why we need context classloader. JNDI API is using it to load JNDI implementation classes from child classloader!