mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Fix bootstrap exceptions (#8397)
During management server initialization, some EmptyStackException and BeansException exceptions are always thrown; These exceptions do not affect ACS, however, they can cause confusion when observing the management server startup logs with DEBUG level on. The causes of the exceptions have been addressed. Co-authored-by: João Jandre <joao@scclouds.com.br>
This commit is contained in:
parent
2eaed80435
commit
687610dd5f
@ -101,9 +101,13 @@ public class DefaultModuleDefinitionSet implements ModuleDefinitionSet {
|
||||
log.debug(String.format("Trying to obtain module [%s] context.", moduleDefinitionName));
|
||||
ApplicationContext context = getApplicationContext(moduleDefinitionName);
|
||||
try {
|
||||
Runnable runnable = context.getBean("moduleStartup", Runnable.class);
|
||||
log.info(String.format("Starting module [%s].", moduleDefinitionName));
|
||||
runnable.run();
|
||||
if (context.containsBean("moduleStartup")) {
|
||||
Runnable runnable = context.getBean("moduleStartup", Runnable.class);
|
||||
log.info(String.format("Starting module [%s].", moduleDefinitionName));
|
||||
runnable.run();
|
||||
} else {
|
||||
log.debug(String.format("Could not get module [%s] context bean.", moduleDefinitionName));
|
||||
}
|
||||
} catch (BeansException e) {
|
||||
log.warn(String.format("Failed to start module [%s] due to: [%s].", moduleDefinitionName, e.getMessage()));
|
||||
if (log.isDebugEnabled()) {
|
||||
@ -126,6 +130,10 @@ public class DefaultModuleDefinitionSet implements ModuleDefinitionSet {
|
||||
public void with(ModuleDefinition def, Stack<ModuleDefinition> parents) {
|
||||
try {
|
||||
String moduleDefinitionName = def.getName();
|
||||
if (parents.isEmpty()) {
|
||||
log.debug(String.format("Could not find module [%s] context as they have no parents.", moduleDefinitionName));
|
||||
return;
|
||||
}
|
||||
log.debug(String.format("Trying to obtain module [%s] context.", moduleDefinitionName));
|
||||
ApplicationContext parent = getApplicationContext(parents.peek().getName());
|
||||
log.debug(String.format("Trying to load module [%s] context.", moduleDefinitionName));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user