Reputation: 6364
I am sure lot of people are familiar with Caused by: java.lang.NoClassDefFoundError
and I am trying to debug that error for one my application.
I fail to understand what execution path classloaders take when I run my application even though I read some tutorials prior to asking this question. Now, I do know how to fix the problem (I can simple add the jar where the missing class belongs to the classpath and that fixes the problem) however I fail to understand what path a classloader or all classloaders are taking when I run my application using java -jar myapp.jar
?
so I am wondering if there is any tool that can show me how classes are getting loaded one by one and the name of the classloader that loaded a particular class ? This would be super helpful to debug application else I feel like I am shooting in the dark.
Upvotes: 1
Views: 188
Reputation: 7069
You could try Java Flight Recorder and Java Mission Control.
In the recording wizard you can check Class Loading and the JVM will record the class, timestamp, thread, stack trace, defining and initiating class loader.
You could also turn on logging.
Upvotes: 1