diff --git a/core/runtime/src/main/java/io/quarkus/runtime/ApplicationLifecycleManager.java b/core/runtime/src/main/java/io/quarkus/runtime/ApplicationLifecycleManager.java index 981b7c8497bdf5..4c7ed149e17376 100644 --- a/core/runtime/src/main/java/io/quarkus/runtime/ApplicationLifecycleManager.java +++ b/core/runtime/src/main/java/io/quarkus/runtime/ApplicationLifecycleManager.java @@ -156,11 +156,7 @@ public static void run(Application application, Class'."); } - } else if (rootCause instanceof ConfigurationException) { + } else if (ExceptionUtil.isAnyCauseInstanceOf(e, ConfigurationException.class)) { System.err.println(rootCause.getMessage()); e.printStackTrace(); } else if (rootCause instanceof PreventFurtherStepsException diff --git a/core/runtime/src/main/java/io/quarkus/runtime/util/ExceptionUtil.java b/core/runtime/src/main/java/io/quarkus/runtime/util/ExceptionUtil.java index 99fbf4fdce04ce..b27f844b3cf06a 100644 --- a/core/runtime/src/main/java/io/quarkus/runtime/util/ExceptionUtil.java +++ b/core/runtime/src/main/java/io/quarkus/runtime/util/ExceptionUtil.java @@ -86,6 +86,17 @@ public static Throwable getRootCause(Throwable exception) { return chain.isEmpty() ? null : chain.get(chain.size() - 1); } + public static boolean isAnyCauseInstanceOf(Throwable exception, Class classToCheck) { + Throwable curr = exception; + do { + if (classToCheck.isInstance(curr)) { + return true; + } + curr = curr.getCause(); + } while (curr != null); + return false; + } + /** * Creates and returns a new {@link Throwable} which has the following characteristics: *