The class org.apache.shindig.common.xml.XmlUtil caches a javax.xml.parsers.DocumentBuilder in the ThreadLocal reusableBuilder variable. These instances are created with the static ErrorHandler instance which creates the strong reference to the XmlUtil class that prevents the ClassLoader from being reclaimed. Currently the only way to turn off this behaviour is for DocumentBuilder.reset() to throw