M
Mike Schilling
I have some Java code that analyzes Java code using reflection. It
loads classes using ClassLoader.loadClass() (catching the
ClassNotFoundException if they're missing) and then uses reflection to
gather data about them. I started up what should have been a long run
before I left work, and later this evening remoted in to find that it
had died almost immediately.
Why? It appears that trying to load class AaaBbb but finding class
Aaabbb whose name differs only in case (quite easy to do on a
case-insensitive file system), instead of throwing a
ClassNotFoundException, throws a NoClassDefFoundError (that's right,
Error.) This was not caught, and caused the program to exit. This is
not documented behavior. It's not hard to fix (catch Throwable
instead of the expected ClassNotFoundException), but the result is
that something which should have completd overnight might or might not
be done by tomorrow morning.
loads classes using ClassLoader.loadClass() (catching the
ClassNotFoundException if they're missing) and then uses reflection to
gather data about them. I started up what should have been a long run
before I left work, and later this evening remoted in to find that it
had died almost immediately.
Why? It appears that trying to load class AaaBbb but finding class
Aaabbb whose name differs only in case (quite easy to do on a
case-insensitive file system), instead of throwing a
ClassNotFoundException, throws a NoClassDefFoundError (that's right,
Error.) This was not caught, and caused the program to exit. This is
not documented behavior. It's not hard to fix (catch Throwable
instead of the expected ClassNotFoundException), but the result is
that something which should have completd overnight might or might not
be done by tomorrow morning.