You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "JAkutenshi (via GitHub)" <gi...@apache.org> on 2026/02/16 20:38:03 UTC
[PR] IGNITE-26345 Wrap ExceptionInInitializerError that happens in contructor of IgniteImpl when launched without JVM options "--add-opens=..." [ignite-3]
JAkutenshi opened a new pull request, #7606:
URL: https://github.com/apache/ignite-3/pull/7606
JIRA Ticket: [IGNITE-26345](https://issues.apache.org/jira/browse/IGNITE-26345)
## The goal
## The reason
## The solution
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-26345 Wrap ExceptionInInitializerError that happens in contructor of IgniteImpl when launched without JVM options "--add-opens=..." [ignite-3]
Posted by "denis-chudov (via GitHub)" <gi...@apache.org>.
denis-chudov commented on code in PR #7606:
URL: https://github.com/apache/ignite-3/pull/7606#discussion_r2853724128
##########
modules/core/src/main/java/org/apache/ignite/internal/util/ExceptionUtils.java:
##########
@@ -471,6 +471,29 @@ public static Throwable unwrapCause(Throwable e) {
return e;
}
+ /**
+ * Unwraps exception cause until the given cause type from the given wrapper exception. If there is no any cause of the expected type
+ * then the original exception will be thrown.
+ *
+ * @param e The exception to unwrap.
+ * @param causeType Expected type of a cause to look up.
+ * @return The desired cause of the exception.
+ * @throws Throwable Original exception in case if there is no cause with given type.
+ */
+ public static <T extends Throwable> T unwrapCause(Throwable e, Class<T> causeType) {
+ Throwable cause = e;
+
+ while (!causeType.isAssignableFrom(cause.getClass()) && cause.getCause() != null) {
Review Comment:
I would set maximum steps count here
##########
modules/core/src/main/java/org/apache/ignite/internal/util/ExceptionUtils.java:
##########
@@ -471,6 +471,29 @@ public static Throwable unwrapCause(Throwable e) {
return e;
}
+ /**
+ * Unwraps exception cause until the given cause type from the given wrapper exception. If there is no any cause of the expected type
+ * then the original exception will be thrown.
+ *
+ * @param e The exception to unwrap.
+ * @param causeType Expected type of a cause to look up.
+ * @return The desired cause of the exception.
+ * @throws Throwable Original exception in case if there is no cause with given type.
+ */
+ public static <T extends Throwable> T unwrapCause(Throwable e, Class<T> causeType) {
+ Throwable cause = e;
+
+ while (!causeType.isAssignableFrom(cause.getClass()) && cause.getCause() != null) {
+ cause = cause.getCause();
+ }
+
+ if (!causeType.isInstance(cause)) {
+ sneakyThrow(e);
+ }
Review Comment:
Looks weird. Why would unwrapCause throw the exception that it tries to process?
It may return either null or original exception, but not throw
##########
modules/runner/src/main/java/org/apache/ignite/internal/app/IgniteServerImpl.java:
##########
@@ -617,12 +633,60 @@ private static void sync(CompletableFuture<Void> future) {
try {
future.get();
} catch (ExecutionException e) {
+ if (hasCause(e, NodeStartException.class)) {
+ sneakyThrow(e.getCause());
+ }
+
throw sneakyThrow(tryToCopyExceptionWithCause(e));
} catch (InterruptedException e) {
throw sneakyThrow(e);
}
}
+ private static void throwIfError(Throwable exception) {
+ Error error;
+
+ try {
+ error = unwrapCause(exception, Error.class);
+ } catch (Throwable originalException) {
+ return;
+ }
+
+ throwIfExceptionInInitializerError(error);
+
+ throw new NodeStartException("Error occurred during node start, check .jar libraries and JVM execution arguments.", error);
+ }
+
+ private static void throwIfExceptionInInitializerError(Error error) {
+ ExceptionInInitializerError initializerError;
+ try {
+ initializerError = unwrapCause(error, ExceptionInInitializerError.class);
+ } catch (Error otherError) {
+ return;
+ }
+
+ Throwable initializerErrorCause = initializerError.getCause();
+
+ if (initializerErrorCause == null) {
+ throw new NodeStartException(
+ "Error during static components initialization with unknown cause, check .jar libraries and JVM execution arguments.",
+ initializerError
+ );
+ }
+
+ if (initializerErrorCause instanceof IllegalAccessException) {
+ throw new NodeStartException(
+ "Error during static components initialization due to illegal code access, check --add-opens JVM execution arguments.",
+ initializerErrorCause
+ );
+ }
+
+ throw new NodeStartException(
+ "Error during static components initialization, check .jar libraries and JVM execution arguments.",
Review Comment:
```suggestion
"Error during static components initialization, make sure that classpath and JVM execution arguments are correct.",
```
##########
modules/runner/src/main/java/org/apache/ignite/internal/app/IgniteServerImpl.java:
##########
@@ -617,12 +633,60 @@ private static void sync(CompletableFuture<Void> future) {
try {
future.get();
} catch (ExecutionException e) {
+ if (hasCause(e, NodeStartException.class)) {
+ sneakyThrow(e.getCause());
+ }
+
throw sneakyThrow(tryToCopyExceptionWithCause(e));
} catch (InterruptedException e) {
throw sneakyThrow(e);
}
}
+ private static void throwIfError(Throwable exception) {
+ Error error;
+
+ try {
+ error = unwrapCause(exception, Error.class);
+ } catch (Throwable originalException) {
+ return;
+ }
+
+ throwIfExceptionInInitializerError(error);
+
+ throw new NodeStartException("Error occurred during node start, check .jar libraries and JVM execution arguments.", error);
+ }
+
+ private static void throwIfExceptionInInitializerError(Error error) {
+ ExceptionInInitializerError initializerError;
+ try {
+ initializerError = unwrapCause(error, ExceptionInInitializerError.class);
+ } catch (Error otherError) {
+ return;
+ }
+
+ Throwable initializerErrorCause = initializerError.getCause();
+
+ if (initializerErrorCause == null) {
+ throw new NodeStartException(
+ "Error during static components initialization with unknown cause, check .jar libraries and JVM execution arguments.",
Review Comment:
```suggestion
"Error during static components initialization, make sure that classpath and JVM execution arguments are correct.",
```
I would remove "with unknown"
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-26345 Wrap ExceptionInInitializerError that happens in contructor of IgniteImpl when launched without JVM options "--add-opens=..." [ignite-3]
Posted by "JAkutenshi (via GitHub)" <gi...@apache.org>.
JAkutenshi commented on code in PR #7606:
URL: https://github.com/apache/ignite-3/pull/7606#discussion_r2871988834
##########
modules/core/src/main/java/org/apache/ignite/internal/util/ExceptionUtils.java:
##########
@@ -471,6 +471,29 @@ public static Throwable unwrapCause(Throwable e) {
return e;
}
+ /**
+ * Unwraps exception cause until the given cause type from the given wrapper exception. If there is no any cause of the expected type
+ * then the original exception will be thrown.
+ *
+ * @param e The exception to unwrap.
+ * @param causeType Expected type of a cause to look up.
+ * @return The desired cause of the exception.
+ * @throws Throwable Original exception in case if there is no cause with given type.
+ */
+ public static <T extends Throwable> T unwrapCause(Throwable e, Class<T> causeType) {
+ Throwable cause = e;
+
+ while (!causeType.isAssignableFrom(cause.getClass()) && cause.getCause() != null) {
Review Comment:
TODOs are added https://issues.apache.org/jira/browse/IGNITE-28026
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-26345 Wrap ExceptionInInitializerError that happens in contructor of IgniteImpl when launched without JVM options "--add-opens=..." [ignite-3]
Posted by "ashapkin (via GitHub)" <gi...@apache.org>.
ashapkin merged PR #7606:
URL: https://github.com/apache/ignite-3/pull/7606
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org