Is there a way to determine which classes are loaded from which jars at runtime?
I'm sure we've all been in JAR hell before. I've run across this problem a lot troubleshooting ClassNotFoundException
s and NoClassDefFoundError
s on projects. I'd like to avoid finding all instances of a class in jars and using process of elimination on the code causing a CNFE to find the culprit.
Will any profiling or management tools give you this kind of information?
This problem is super annoying purely because we should have this information at the time the class gets loaded. There has to be a way to get to it, or record it and find it, yet I know of nothing that will do this, do you?
I know OSGi and versioned bundles/modules aim to make this a non issue... but it doesnt seem to be going away any time soon. :)
NOTE: I found this question is a subset of my question related to classes loaded from versioned jars.
Update: Somewhat related, this post explains a strategy to search for a class within jars (either under the current directory) or in your M2_REPO. http://stackoverflow.com/questions/759923/jarscan-scan-all-jar-files-in-all-subfolders-for-specific-class
Update 2: Also somewhat related, JBoss Tattletale