Details
-
Improvement
-
Resolution: Unresolved
-
Major
-
None
-
None
-
None
-
None
Description
Guice.createInjector(resolveStageToUse(), module) can fail on several different exceptions (for example com.google.common.util.concurrent.ExecutionError: java.lang.NoClassDefFoundError: info/magnolia/cms/servlets/CommandBasedMVCServletHandler), but we are handling/log only when com.google.inject.CreationException occurs.
try { Injector injector = Guice.createInjector(resolveStageToUse(), module); injector.injectMembers(componentProvider); return componentProvider; } catch (CreationException e) { log.error("Magnolia failed to load module configuration with types {} and components {}. Please ensure you don't have any legacy modules present in your web application.", configuration.getAnnotatedTypeMappings(), configuration.getAnnotatedComponents(), e); throw e; }
Problem is when the error occurs for example during startup because Magnolia then tries to do MgnlContext.release(), but this fails on NPE because injector is not set in ComponentProvider. You will then get only stacktrace of NPE and is hard to figure out what is cause of issue.
We had problem with this on corporate website, also https://forum.magnolia-cms.com/forum/thread.html?threadId=215d4e7f-21b4-483c-ba5d-c81dc1331315 and SUPPORT-7807...