JAVA directly goes to finally or exits because it does not pass Catch (Exception e ).
Today I encountered a very strange problem! When writing a Hadoop program! A new object! The program directly runs into the finally code block! The Exception in Catch is not executed either. Configuration configuration = new Configuration (); I have been wondering for a long time! Go to the Hadoop source code! The new object does not perform any operations, but some normal values are assigned! Later I found it online for a long time. It turned out to be Throwable! Exception is a subclass of Throwable, so it cannot be captured. The error message can be printed only when Throwable is captured! The original reason is that there is a static variable in the Hadoop Configuration class. When the ClassLoader loads the class, an exception occurs: private static final Log = LogFactory. getLog (Configuration. class); my error is very retarded, just because I didn't add the common-logging package! I believe that this kind of thing rarely happens! However, if we encounter this problem today, we should consider it as a lesson, so that those who have such questions can be solved! So in the future, do not think that Catch (Exception e) is even if everything is done, throwable is the ultimate BOSS! Why Throwable instead of Exception is thrown here? I have never found any reason! Which of the following is the hope! Thank you!