[jboss-dev] Multiple classLoaders for a single WAR file on Tomcat

Clebert Suconic csuconic at redhat.com
Mon Aug 6 12:53:51 EDT 2007


This is where URLClassLoader is being created:


https://svn.jboss.org/repos/jbossas/branches/Branch_4_2/server/src/main/org/jboss/web/AbstractWebContainer.java

line 410>       di.annotationsCl = new URLClassLoader(urlArr, di.ucl);



Clebert Suconic wrote:
> I can't tell where this is being created.. but I can tell where is being 
> referenced.
> 
> 
> the URLClassLoader is being referenced at DeploymentInfo.annotationsCL:
> 
> 
> 
> java.net.URLClassLoader at 21471599
> !--- FieldReference public transient java.net.URLClassLoader 
> org.jboss.deployment.DeploymentInfo.annotationsCl=org.jboss.deployment.DeploymentInfo at 3720195 
>  Detail
> !--- FieldReference private java.lang.ClassLoader 
> java.security.ProtectionDomain.classloader=java.security.ProtectionDomain at 28805459 
>  Detail
> !--- FieldReference private final transient java.lang.ClassLoader 
> java.lang.Package.loader=java.lang.Package at 13417143
> 
> 
> The other one (WebAppClassLoader) has a bunch of references on Tomcat 
> and Jasper compiler...
> 
> 
> 
> Sometimes those deployments are dulicated for some reason... When I get 
> the URLClassLoader duplicated, I have two distinct 
> DeploymentInfo.annotationsCLs referencing it.  (ON jboss-4.0.5). on 
> JBoss 4-2 I haven't seen the same behavior when I tried (tried only once).
> 
> 
> Clebert
> 
> Scott M Stark wrote:
>> That should only be true if the context is enabled for that, and I did
>> not think that was the default. Can you show the creation point of each
>> class loader involved here?
>>
>> Adrian wrote:
>>> I assume this is because Servlets can be individually reloaded?
>>>
>>> On Fri, 2007-08-03 at 17:11 -0500, Clebert Suconic wrote:
>>>> This is probably a question for Remy:
>>>>
>>>> Why Tomcat creates multiple ClassLoaders for every deployment?
>>>>
>>>> Is this by design or this is a leak?
>>>>
>>>> For a single WAR, I'm seeing 4 classLoaders deployed just wasting 
>>>> PermGeneration memory.
>>>>
>>>> For example, I deployed a single WAR, and I've got this Servlet 
>>>> loaded by 4 distinct classLoaders. and this is a standard behavior I 
>>>> have seen on Tomcat for a long time already.
>>>>
>>>> org.jboss.on.plugins.servlet.test.Counter:
>>>>
>>>> - java.net.URLClassLoader at 10891966
>>>> - org.jboss.web.tomcat.tc5.WebAppClassLoader at 18775238
>>>> - java.net.URLClassLoader at 22498184
>>>> - org.jboss.web.tomcat.tc5.WebAppClassLoader at 8238932
>>>>
>>>>
>>>> Also... if you use any other profiler (besides the ClassLoader 
>>>> analysis I've written on JBossProfiler) you could be foolished by 
>>>> them as those classes won't have any instances... Just the classDef 
>>>> loaded on the heap.
>>>>
>>>>
>>>>
>>>> Clebert
>>
>> _______________________________________________
>> jboss-development mailing list
>> jboss-development at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/jboss-development
> 
> _______________________________________________
> jboss-development mailing list
> jboss-development at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jboss-development




More information about the jboss-development mailing list