Skip to content

Commit 687610d

Browse files
JoaoJandreJoão Jandre
andauthored
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>
1 parent 2eaed80 commit 687610d

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

framework/spring/module/src/main/java/org/apache/cloudstack/spring/module/model/impl/DefaultModuleDefinitionSet.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,13 @@ public void with(ModuleDefinition def, Stack<ModuleDefinition> parents) {
101101
log.debug(String.format("Trying to obtain module [%s] context.", moduleDefinitionName));
102102
ApplicationContext context = getApplicationContext(moduleDefinitionName);
103103
try {
104-
Runnable runnable = context.getBean("moduleStartup", Runnable.class);
105-
log.info(String.format("Starting module [%s].", moduleDefinitionName));
106-
runnable.run();
104+
if (context.containsBean("moduleStartup")) {
105+
Runnable runnable = context.getBean("moduleStartup", Runnable.class);
106+
log.info(String.format("Starting module [%s].", moduleDefinitionName));
107+
runnable.run();
108+
} else {
109+
log.debug(String.format("Could not get module [%s] context bean.", moduleDefinitionName));
110+
}
107111
} catch (BeansException e) {
108112
log.warn(String.format("Failed to start module [%s] due to: [%s].", moduleDefinitionName, e.getMessage()));
109113
if (log.isDebugEnabled()) {
@@ -126,6 +130,10 @@ protected void loadContexts() {
126130
public void with(ModuleDefinition def, Stack<ModuleDefinition> parents) {
127131
try {
128132
String moduleDefinitionName = def.getName();
133+
if (parents.isEmpty()) {
134+
log.debug(String.format("Could not find module [%s] context as they have no parents.", moduleDefinitionName));
135+
return;
136+
}
129137
log.debug(String.format("Trying to obtain module [%s] context.", moduleDefinitionName));
130138
ApplicationContext parent = getApplicationContext(parents.peek().getName());
131139
log.debug(String.format("Trying to load module [%s] context.", moduleDefinitionName));

0 commit comments

Comments
 (0)