I am having trouble Hot Deploying a Spring-MVC 4.0 (not SpringBoot) Web Application. I am trying to go xml-less and just use JavaConfig. OutOfMemoryErrors result when
I believe Luke is right that this issue may be caused by a bug in Log4j2.
The bug is that if the
element is not present in the web.xml, the Log4jServletContextListener
class responsible for log4j resource management can only start, but not stop log4j.
This means that no cleanup happens when the web application is stopped or restarted. JMX MBeans are not unregistered, but also any threads are not stopped, and as a result Log4j classes are not unloaded. The leaked memory grows every time the web app is restarted, because each web app has its own classloader (so the VM sees them as different classes).
This bug is fixed in Git master now and the fix will be part of the log4j 2.5 release. Meanwhile, please use a
element in your web.xml.