Say I'm debugging some weird class loading issues of an application deployed inside of a Java EE app server. By some reason it appears, that I have duplicate jars on the class paths of two classloaders (2 different EAR classloaders), and the classes from namespaces of these class loaders need to colaborate.
So the question is following: does exist any tool which can show an image (picture) of class loader tree together with the repository of each class loader? Of course, it's not of big importance to show exactly a picture, if it could be some kind of a dynamic user interface (i.e. like Windows Explorer tree folding/unfolding), I would be very happy.
UPD: I'm using JBoss 5.1.
Thanks
A Java Class is stored in the form of byte code in a . class file after it is compiled. The ClassLoader loads the class of the Java program into memory when it is required. The ClassLoader is hierarchical and so if there is a request to load a class, it is delegated to the parent class loader.
To know the ClassLoader that loads a class the getClassLoader() method is used. All classes are loaded based on their names and if any of these classes are not found then it returns a NoClassDefFoundError or ClassNotFoundException.
As we can see, there are three different class loaders here: application, extension, and bootstrap (displayed as null). The application class loader loads the class where the example method is contained. An application or system class loader loads our own files in the classpath.
For example, java. lang package class. Extensions Class Loader: It delegates class loading request to its parent. If the loading of a class is unsuccessful, it loads classes from jre/lib/ext directory or any other directory as java.
In JBoss you can log all classloader events, which should tell you precisely where your conflicting classes are, if you can sift through the verbosity.
Or you can go to the jmx-console, find the jboss.classloader section, find the entry for your ear (something like id="vfszip:/apps/jboss-5.1.0.GA/server/default/deploy/your.war/") and invoke findClassLoaderForClass for the class that's giving you problems.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With