Skip to content

Commit

Permalink
fix(core): handle NoClassDefFoundError in PluginScanner
Browse files Browse the repository at this point in the history
  • Loading branch information
fhussonnois committed Jun 21, 2024
1 parent bd5d5c5 commit 80db45c
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions core/src/main/java/io/kestra/core/plugins/PluginScanner.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ private RegisteredPlugin scanClassLoader(final ClassLoader classLoader,

final ServiceLoader<Plugin> sl = ServiceLoader.load(Plugin.class, classLoader);
try {
sl.forEach(plugin -> {
for (Plugin plugin : sl) {
if (plugin.getClass().isAnnotationPresent(Hidden.class)) {
return;
continue;
}

switch (plugin) {
Expand Down Expand Up @@ -141,10 +141,14 @@ private RegisteredPlugin scanClassLoader(final ClassLoader classLoader,
}

Plugin.getAliases(plugin.getClass()).forEach(alias -> aliases.put(alias, plugin.getClass()));
});
} catch (ServiceConfigurationError e) {
}
} catch (ServiceConfigurationError | NoClassDefFoundError e) {
Object location = externalPlugin != null ? externalPlugin.getLocation() : "core";
log.error("Unable to load all plugin classes from '{}'. Cause: {}", location, e.getMessage());
log.error("Unable to load all plugin classes from '{}'. Cause: [{}] {}",
location,
e.getClass().getSimpleName(),
e.getMessage()
);
}

var guidesDirectory = classLoader.getResource("doc/guides");
Expand Down

0 comments on commit 80db45c

Please sign in to comment.