More as an experiment, I decided to enable the following breakpoint in the Eclipse debugger: Throwable [Include Subclasses]: caught and uncaught. I then let my code (which is running “fine” as far as I know) run under the debugger, and was surprised to see dozens of exceptions being thrown and caught (previously unknown to me) by standard J2SE library code when my code was running normally for all I know.
For example, here are just some of the Java framework functions I found throwing exceptions: URLClassLoader.findClass, FileDirContext.lookup, and WebappClassLoader.findClassInternal.
Is this considered normal behavior for a Java application? Is this something I should look into? My code seems to be running fine as far as I know.
Exceptions thrown during class-loading are relic from early days in Java history when class loading was designed to use them as a way how to communicate that some class-loader was not able to find a class. It is not considered to be a good pattern now but it remains there and probably won’t be changed ever as it is part of APIs. Nothing to be scared of.