diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java index 2313f83b47c..ae4a35fec74 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java @@ -2858,7 +2858,15 @@ public abstract class FileSystem extends Configured implements Closeable { ClassUtil.findContainingJar(fs.getClass()), e); } } catch (ServiceConfigurationError ee) { - LOG.warn("Cannot load filesystem", ee); + LOG.warn("Cannot load filesystem: " + ee); + Throwable cause = ee.getCause(); + // print all the nested exception messages + while (cause != null) { + LOG.warn(cause.toString()); + cause = cause.getCause(); + } + // and at debug: the full stack + LOG.debug("Stack Trace", ee); } } FILE_SYSTEMS_LOADED = true; diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFileSystemInitialization.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFileSystemInitialization.java index 18e8b017c6c..4d627a5e8e2 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFileSystemInitialization.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFileSystemInitialization.java @@ -47,16 +47,12 @@ public class TestFileSystemInitialization { @Test public void testMissingLibraries() { - boolean catched = false; try { Configuration conf = new Configuration(); - FileSystem.getFileSystemClass("s3a", conf); - } catch (Exception e) { - catched = true; - } catch (ServiceConfigurationError e) { - // S3A shouldn't find AWS SDK and fail - catched = true; + Class fs = FileSystem.getFileSystemClass("s3a", + conf); + fail("Expected an exception, got a filesystem: " + fs); + } catch (Exception | ServiceConfigurationError expected) { } - assertTrue(catched); } }