<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi All,<div><br></div><div>I&#39;m using Weld in Open Liberty and seeing a NullPointerException from WeldInitialListener when an app fails to start.  The scenario goes something like this:</div><div>1) Server and app starts to start.</div><div>2) An error occurs in my app code throwing an uncaught exception.</div><div>3) Liberty&#39;s web container code then attempts to stop the still-not-yet-started app - this calls the WeldInitialListener&#39;s contextDestroyed method without ever calling the contextCreated method.</div><div>4) Because contextCreated was never called, there is a NullPointerException thrown from contextDestroyed (the lifecycle field is null), which ends up masking the root cause of the problem.</div><div><br></div><div>I am in the process of fixing part of the problem (not logging the original exception) in Open Liberty issue 13124[1], but I wonder if we should also check if lifecycle is null in the contextDestroyed method[2] to avoid the NPE.</div><div><br></div><div>Thanks,</div><div><br></div><div>Andy</div><div><br></div><div>[1] <a href="https://github.com/OpenLiberty/open-liberty/issues/13124">https://github.com/OpenLiberty/open-liberty/issues/13124</a></div><div>[2] <a href="https://github.com/weld/core/blob/2fe5d1f64c03b89cc562a14cda317098225590c7/modules/web/src/main/java/org/jboss/weld/module/web/servlet/WeldInitialListener.java#L113">https://github.com/weld/core/blob/2fe5d1f64c03b89cc562a14cda317098225590c7/modules/web/src/main/java/org/jboss/weld/module/web/servlet/WeldInitialListener.java#L113</a></div><div><br></div><div><br></div></div></div></div></div>