This is an automated email from the ASF dual-hosted git repository.
DaanHoogland pushed a commit to branch 4.22
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/4.22 by this push:
new 288f9a9fd73 framework/spring: throw RuntimeException when fail to
start or load a module (#13186)
288f9a9fd73 is described below
commit 288f9a9fd73e8715f912db20227bdf61a6496f1a
Author: Wei Zhou <[email protected]>
AuthorDate: Mon Jun 22 08:22:27 2026 +0200
framework/spring: throw RuntimeException when fail to start or load a
module (#13186)
---
.../spring/lifecycle/CloudStackExtendedLifeCycle.java | 3 ++-
.../spring/module/model/impl/DefaultModuleDefinitionSet.java | 12 ++++--------
2 files changed, 6 insertions(+), 9 deletions(-)
diff --git
a/framework/spring/lifecycle/src/main/java/org/apache/cloudstack/spring/lifecycle/CloudStackExtendedLifeCycle.java
b/framework/spring/lifecycle/src/main/java/org/apache/cloudstack/spring/lifecycle/CloudStackExtendedLifeCycle.java
index 170e3b40e94..bd3e424f767 100644
---
a/framework/spring/lifecycle/src/main/java/org/apache/cloudstack/spring/lifecycle/CloudStackExtendedLifeCycle.java
+++
b/framework/spring/lifecycle/src/main/java/org/apache/cloudstack/spring/lifecycle/CloudStackExtendedLifeCycle.java
@@ -73,7 +73,8 @@ public class CloudStackExtendedLifeCycle extends
AbstractBeanCollector {
try {
lifecycle.start();
} catch (Exception e) {
- logger.error("Error on starting bean {} - {}",
lifecycle.getName(), e.getMessage(), e);
+ logger.error("Error on starting bean [{}] due to: {}",
lifecycle.getName(), e);
+ throw new CloudRuntimeException("Failed to start bean [" +
lifecycle.getName() + "]");
}
if (lifecycle instanceof ManagementBean) {
diff --git
a/framework/spring/module/src/main/java/org/apache/cloudstack/spring/module/model/impl/DefaultModuleDefinitionSet.java
b/framework/spring/module/src/main/java/org/apache/cloudstack/spring/module/model/impl/DefaultModuleDefinitionSet.java
index 2a6d0b63e5c..78693f72140 100644
---
a/framework/spring/module/src/main/java/org/apache/cloudstack/spring/module/model/impl/DefaultModuleDefinitionSet.java
+++
b/framework/spring/module/src/main/java/org/apache/cloudstack/spring/module/model/impl/DefaultModuleDefinitionSet.java
@@ -112,10 +112,8 @@ public class DefaultModuleDefinitionSet implements
ModuleDefinitionSet {
logger.debug(String.format("Could not get module
[%s] context bean.", moduleDefinitionName));
}
} catch (BeansException e) {
- logger.warn(String.format("Failed to start module [%s]
due to: [%s].", moduleDefinitionName, e.getMessage()));
- if (logger.isDebugEnabled()) {
- logger.debug(String.format("module start failure
of module [%s] was due to: ", moduleDefinitionName), e);
- }
+ logger.error("Failed to start module [{}] due to: {}",
def.getName(), e);
+ throw new RuntimeException(String.format("Failed to
start module [%s]", def.getName()));
}
} catch (EmptyStackException e) {
logger.warn(String.format("Failed to obtain module context
due to [%s]. Using root context instead.", e.getMessage()));
@@ -147,10 +145,8 @@ public class DefaultModuleDefinitionSet implements
ModuleDefinitionSet {
logger.debug("Failed to obtain module context: ", e);
}
} catch (BeansException e) {
- logger.warn(String.format("Failed to start module [%s] due
to: [%s].", def.getName(), e.getMessage()));
- if (logger.isDebugEnabled()) {
- logger.debug(String.format("module start failure of
module [%s] was due to: ", def.getName()), e);
- }
+ logger.error("Failed to load module [{}] due to: {}",
def.getName(), e);
+ throw new RuntimeException(String.format("Failed to load
module [%s]", def.getName()));
}
}
});