Plugin clasloader overly agressive?

I'm writing a plugin that uses a third party tool to process an xml config file. This config file contains a number of fully qualified classnames, all of which are expected to be on the classpath. I've discovered that if a class referenced in the config file depends on a class that is not on the classpath, Sun's classloader has no problem loading the class, but the plugin classloader immediately throw a NoClassDefFoundError. Sun's classloader holds off throwing this error until I try to actually instantiate an instance of the class with the unavailable dependency. It appears that the plugin classloader immediately tries to resolve all dependencies. I am not a classloader expert, nor do I have any desire to become one. I would, however, like to know which classloader is exhibiting the correct behavior or if the correct behavior is, in this case, undefined.

Thanks,
Max

Please sign in to leave a comment.