HessianServlet sets up a ServiceContext type for convenience, this uses a ThreadLocal to store an instance of ServiceContext however when the service call completes it does not clean up the ThreadLocal. This dangling ThreadLocal reference prevents Tomcat from freeing the ClassLoader associated with the webapp.

It looks like ServiceContext.end() should call _localContext.remove()

Additional Information

The error message produced by Tomcat 7:

SEVERE: The web application [/hessianwebapp] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@655e3dc4]) and a value of type [com.caucho.services.server.ServiceContext] (value [com.caucho.services.server.ServiceContext@e2942da]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
07-Feb-2011 12:56:31 org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: The web application [/hessianwebapp] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@655e3dc4]) and a value of type [com.caucho.services.server.ServiceContext] (value [com.caucho.services.server.ServiceContext@36e3fd79]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
07-Feb-2011 12:56:31 org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: The web application [/hessianwebapp] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@655e3dc4]) and a value of type [com.caucho.services.server.ServiceContext] (value [com.caucho.services.server.ServiceContext@32162f16]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
07-Feb-2011 12:56:31 org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: The web application [/hessianwebapp] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@655e3dc4]) and a value of type [com.caucho.services.server.ServiceContext] (value [com.caucho.services.server.ServiceContext@4e6d670a]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
07-Feb-2011 12:56:31 org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: The web application [/hessianwebapp] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@655e3dc4]) and a value of type [com.caucho.services.server.ServiceContext] (value [com.caucho.services.server.ServiceContext@7087e9bf]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
07-Feb-2011 12:56:31 org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: The web application [/hessianwebapp] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@655e3dc4]) and a value of type [com.caucho.services.server.ServiceContext] (value [com.caucho.services.server.ServiceContext@6b033450]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
07-Feb-2011 12:56:31 org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: The web application [/hessianwebapp] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@655e3dc4]) and a value of type [com.caucho.services.server.ServiceContext] (value [com.caucho.services.server.ServiceContext@1f5fa713]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
07-Feb-2011 12:56:31 org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: The web application [/hessianwebapp] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@655e3dc4]) and a value of type [com.caucho.services.server.ServiceContext] (value [com.caucho.services.server.ServiceContext@40d1e07c]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.