I was seeing an annoying issue with a webapp having trouble shutting down cleanly. I would issue the tomcat stop command and most everything would shutdown, but I’d get this error:
Exception in thread "Multicast Heartbeat Receiver Thread" java.lang.NullPointerException at org.slf4j.impl.Log4jLoggerAdapter.error(Log4jLoggerAdapter.java:493) at net.sf.ehcache.distribution.MulticastKeepaliveHeartbeatReceiver$MulticastReceiverThread.run(MulticastKeepaliveHeartbeatReceiver.java:137)
After the error, the Multicast Heartbeat Receiver would not shutdown and would just hang. Eventually you would have to kill off the java process manually.
Doing a quick search found this page. With a small snippet added to the web.xml to add a shutdown listener everything shutdowns cleanly now.
<listener> <listener-class>net.sf.ehcache.constructs.web.ShutdownListener</listener-class> </listener>