<div dir="ltr">Looking at this a bit closer it seems that Tomcat 7.0.35 will call stop() if the lifecycle state is set to FAILED.<br><br><a href="http://grepcode.com/file/repo1.maven.org/maven2/org.apache.tomcat/tomcat-catalina/7.0.35/org/apache/catalina/util/LifecycleBase.java">http://grepcode.com/file/repo1.maven.org/maven2/org.apache.tomcat/tomcat-catalina/7.0.35/org/apache/catalina/util/LifecycleBase.java</a> line 141.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jun 29, 2015 at 9:45 AM, Matthew Casperson <span dir="ltr">&lt;<a href="mailto:matthew.casperson@autogeneral.com.au" target="_blank">matthew.casperson@autogeneral.com.au</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div> I have been seeing this a bit recently (I&#39;m using KeyCloak 1.2.0). I haven&#39;t tracked down a reproducible test case yet, but I&#39;m wondering if there are situations where Tomcat will attempt to stop the value before it is started, which leads to nodesRegistrationManagement being null.<br><br></div>Maybe it is worth adding a null check in AbstractKeycloakAuthenticatorValve.beforeStop()?<div><div><br>java.lang.NullPointerException<br>     at org.keycloak.adapters.tomcat.AbstractKeycloakAuthenticatorValve.beforeStop(AbstractKeycloakAuthenticatorValve.java:130)<br>     at org.keycloak.adapters.tomcat.AbstractKeycloakAuthenticatorValve.lifecycleEvent(AbstractKeycloakAuthenticatorValve.java:67)<br>     at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)<br>     at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)<br>     at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:226)<br>     at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:272)<br>     at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:1041)<br>     at org.apache.catalina.startup.HostConfig.deleteRedeployResources(HostConfig.java:1300)<br>     at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1251)<br>     at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1460)<br>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br>     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)<br>     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)<br>     at java.lang.reflect.Method.invoke(Method.java:483)<br>     at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301)<br>     at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)<br>     at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)<br>     at org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1445)<br>     at org.apache.catalina.manager.ManagerServlet.undeploy(ManagerServlet.java:1381)<br>     at org.apache.catalina.manager.HTMLManagerServlet.undeploy(HTMLManagerServlet.java:674)<br>     at org.apache.catalina.manager.HTMLManagerServlet.doPost(HTMLManagerServlet.java:215)<br>     at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)<br>     at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)<br>     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)<br>     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)<br>     at org.apache.catalina.filters.CsrfPreventionFilter.doFilter(CsrfPreventionFilter.java:213)<br>     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)<br>     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)<br>     at org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108)<br>     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)<br>     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)<br>     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)<br>     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)<br>     at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:581)<br>     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)<br>     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)<br>     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)<br>     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)<br>     at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)<br>     at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)<br>     at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)<br>     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)<br>     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)<br>     at java.lang.Thread.run(Thread.java:745)<span class="HOEnZb"><font color="#888888"><br clear="all"><br>-- <br><div><div dir="ltr"><div><div dir="ltr"><div><b><font face="tahoma, sans-serif">Matthew Casperson</font></b></div><div><b><font face="tahoma, sans-serif">Senior Front End Developer</font></b></div><div><font face="tahoma, sans-serif">Technology, Space &amp; Distribution</font></div><div><font face="tahoma, sans-serif">Auto &amp; General Holdings Pty Ltd</font></div><div><font face="tahoma, sans-serif">P: 07) 3377 </font><span style="font-family:tahoma,sans-serif;font-size:small">8751</span><font face="tahoma, sans-serif"> (Direct: 3377 </font><span style="font-family:tahoma,sans-serif;font-size:small">8751</span><font face="tahoma, sans-serif">)</font></div><div><font face="tahoma, sans-serif">F: 07) 3377 8833<br><br></font></div><img src="https://sites.google.com/a/autogeneral.com.au/logos/_/rsrc/1375661597693/home/autogeneral.gif" style="border:0px none;max-width:100%;font-family:&quot;Helvetica Neue&quot;,Helvetica,Arial,sans-serif;line-height:18px"><br></div></div></div></div>
</font></span></div></div></div>
</blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><b><font face="tahoma, sans-serif">Matthew Casperson</font></b></div><div><b><font face="tahoma, sans-serif">Senior Front End Developer</font></b></div><div><font face="tahoma, sans-serif">Technology, Space &amp; Distribution</font></div><div><font face="tahoma, sans-serif">Auto &amp; General Holdings Pty Ltd</font></div><div><font face="tahoma, sans-serif">P: 07) 3377 </font><span style="font-family:tahoma,sans-serif;font-size:small">8751</span><font face="tahoma, sans-serif"> (Direct: 3377 </font><span style="font-family:tahoma,sans-serif;font-size:small">8751</span><font face="tahoma, sans-serif">)</font></div><div><font face="tahoma, sans-serif">F: 07) 3377 8833<br><br></font></div><img src="https://sites.google.com/a/autogeneral.com.au/logos/_/rsrc/1375661597693/home/autogeneral.gif" style="border:0px none;max-width:100%;font-family:&#39;Helvetica Neue&#39;,Helvetica,Arial,sans-serif;line-height:18px"><br></div></div></div></div>
</div>

<br>
<pre style="font-family:Menlo,Monaco,&#39;Courier New&#39;,monospace;font-size:12px;white-space:pre-wrap;padding:8.5px;color:rgb(51,51,51);border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-right-radius:4px;border-bottom-left-radius:4px;margin-top:0px;margin-bottom:9px;line-height:18px;background-color:rgb(245,245,245);border:1px solid rgba(0,0,0,0.14902);word-break:break-all;word-wrap:break-word">This email is sent by Auto &amp; General Insurance Company Ltd, Auto &amp; General Services Pty Ltd, Auto &amp; General Holdings Pty Ltd or a related body corporate (Auto &amp; General) and is for the intended addressee.
The views expressed in this email and attachments (email) reflect the views of the stated author but may not reflect views of Auto &amp; General. This email is confidential and subject to copyright. 
It may be privileged. If you are not the intended addressee, confidentiality and privilege have not been waived and any use, interference with, or disclosure of this email is unauthorised. 
If you are not the intended addressee please immediately notify the sender and then delete the email. Auto &amp; General does not warrant that this email is error or virus free.</pre>