Problem:
My company has many different cans / existing projects that they launch with their customers. For debugging purposes, we would like to generate a log to which each component is loaded, and more specifically: where . For example: stack.overflow.ClassA in the jar StackOverFlowJar.jar.
My thoughts:
I experimented with passing each jar / existing project to a custom class loader. This custom class loader can potentially write the above information to a file and delegate the normal class load stream to its parent.
My CustomClassLoader extends ClassLoader, and I see that it loads classes, such as:
java.lang.Class
java.lang.Thread
java.lang.ThreadGroup
etc., all standard Java classes from the main library. These classes really reach my CustomClassLoader. However, as can be seen from the following image:
source: http://javarevisited.blogspot.nl/2012/12/how-classloader-works-in-java.html
There are several classes of ClassLoaders. The Bootstrap ClassLoader (the one I'm producing with CustomClassLoader) is only responsible for the main libraries. If he cannot find the custom created class, he delegates it back to Extension ClassLoader. If the Extension ClassLoader cannot find it, it will pass it back to the Application ClassLoader, and I will see in the debug module, this is really the one that loads my custom classes. But this does not happen with my CustomClassLoader.
:
Application ClassLoader ClassLoader? , ?
!