[Jersey] Re: PermGen Memory Leak in Tomcat

From: Jakub Podlesak <>
Date: Tue, 11 Oct 2011 16:59:21 +0200

Hi Stephen,

I am afraid Jersey does not remove it's thread locals
and there is currently no way to force Jersey to clean up properly.
We need to fix that.

Could you please file a bug report [1] to track this?




On 29.9.2011 12:56, DaveCrystal wrote:
> Hello, I am using Jersey 1.9.1 with spring to create a rest web service
> hosted in Tomcat.
> The application follows the pattern in this example.
> When the web application is undeployed Tomcat logs a warning that the
> application has created a ThreadLocal and not removed it:
> SEVERE: The web application [/sandbox] created a ThreadLocal with key of
> type [null] (value
> [com.sun.jersey.core.impl.provider.xml.ThreadLocalSingletonContextProvider$1_at_])
> and a value of type
> [] (value
> []) but
> failed to remove it when the web application was stopped. This is very
> likely to create a memory leak.
> After deploying and undeploying the app several times Tomcat runs out of
> PermGen space.
> Any advice on how I can cause Jersey to clean up the Thread Locals on
> undeploy would be much appreceiated.
> Thanks a lot.
> --
> View this message in context:
> Sent from the Jersey mailing list archive at