You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by V D <st...@drexel.edu> on 2006/04/08 06:35:45 UTC

[OT] How to write/use Tomcat's war classloader

We have a sizable war file (|unpacked|) that needs to be run in certain 
way outside of Tomcat.  To do this, we created a classloader which works 
Ok except that it's very slow (using JarFile).  I know that when deploy 
apps in Tomcat, I can specify it to not to unpack (|unpackWAR = 
"false").  However, Tomcat load and run the apps quickly. I looked into 
Tomcat source, the org.apache.catalina.loader package and could not find 
anything like that.  I see WebappClassLoader, but it seems to load from 
an unpacked war, not packed war.  Does Tomcat actually unpack the war 
before loading the app?  If not, could someone point me to the right 
place to look, or give some advice on how to write this thing faster?

Thanks,

-vd
|

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [OT] How to write/use Tomcat's war classloader

Posted by V D <st...@drexel.edu>.
Thank you for the info.  That settles it for me.

David Smith wrote:
> Oops, meant unpackWars="false"
>
> David Smith wrote:
>> Tomcat does unpack war files before starting the context. That's 
>> because of performance issues if it really tried to run the app from 
>> an archive. Typically if unpackWars="true", tomcat will unpack to the 
>> work directory instead of the webapps dir.
>>
>> --David
>>
>> V D wrote:
>>> Thank you for your interest.  The application starts very slowly 
>>> with the war and my classloader (this is a standard app, not 
>>> webapp).  The war also has a webapp in it.  This has nothing to do 
>>> with the application logic.  It's the leading time to load the 
>>> classes.  It takes about 2 or 3 minutes.  The same JVM 1.5.0 runs 
>>> Tomcat (5.5.12) would response to request much quicker (about 10 
>>> seconds) after the 1st request.  If I run the war file unpacked and 
>>> using standard classloader, it's a couple of seconds before things 
>>> run.  However, using our own class loader with the packed war (which 
>>> searches all libraries in the lib and classes in the classes 
>>> directory) it takes along time described above.
>>>
>>> My question is about how Tomcat does this in the unpacked war 
>>> scenario.  I couldn't find the Tomcat loader that does this.  I 
>>> suspect it unpacked it first, but this is a wild speculation.
>>>
>>>
>>> P Y wrote:
>>>> maybe you could give a bit more context to interpret "very slow" or 
>>>> "quickly".
>>>> like what version of tc and jvm are you using ... etc
>>>>
>>>>
>>>> On 4/12/06, V D <st...@drexel.edu> wrote:
>>>>  
>>>>> Anyone have an idea about this?
>>>>>
>>>>> V D wrote:
>>>>>  
>>>>>> We have a sizable war file (|unpacked|) that needs to be run in
>>>>>> certain way outside of Tomcat.  To do this, we created a classloader
>>>>>> which works Ok except that it's very slow (using JarFile).  I know
>>>>>> that when deploy apps in Tomcat, I can specify it to not to unpack
>>>>>> (|unpackWAR = "false").  However, Tomcat load and run the apps
>>>>>> quickly. I looked into Tomcat source, the org.apache.catalina.loader
>>>>>> package and could not find anything like that.  I see
>>>>>> WebappClassLoader, but it seems to load from an unpacked war, not
>>>>>> packed war.  Does Tomcat actually unpack the war before loading the
>>>>>> app?  If not, could someone point me to the right place to look, or
>>>>>> give some advice on how to write this thing faster?
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> -vd
>>>>>> |
>>>>>>
>>>>>>       
>>>>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [OT] How to write/use Tomcat's war classloader

Posted by David Smith <dn...@cornell.edu>.
Oops, meant unpackWars="false"

David Smith wrote:
> Tomcat does unpack war files before starting the context. That's 
> because of performance issues if it really tried to run the app from 
> an archive. Typically if unpackWars="true", tomcat will unpack to the 
> work directory instead of the webapps dir.
>
> --David
>
> V D wrote:
>> Thank you for your interest.  The application starts very slowly with 
>> the war and my classloader (this is a standard app, not webapp).  The 
>> war also has a webapp in it.  This has nothing to do with the 
>> application logic.  It's the leading time to load the classes.  It 
>> takes about 2 or 3 minutes.  The same JVM 1.5.0 runs Tomcat (5.5.12) 
>> would response to request much quicker (about 10 seconds) after the 
>> 1st request.  If I run the war file unpacked and using standard 
>> classloader, it's a couple of seconds before things run.  However, 
>> using our own class loader with the packed war (which searches all 
>> libraries in the lib and classes in the classes directory) it takes 
>> along time described above.
>>
>> My question is about how Tomcat does this in the unpacked war 
>> scenario.  I couldn't find the Tomcat loader that does this.  I 
>> suspect it unpacked it first, but this is a wild speculation.
>>
>>
>> P Y wrote:
>>> maybe you could give a bit more context to interpret "very slow" or 
>>> "quickly".
>>> like what version of tc and jvm are you using ... etc
>>>
>>>
>>> On 4/12/06, V D <st...@drexel.edu> wrote:
>>>  
>>>> Anyone have an idea about this?
>>>>
>>>> V D wrote:
>>>>   
>>>>> We have a sizable war file (|unpacked|) that needs to be run in
>>>>> certain way outside of Tomcat.  To do this, we created a classloader
>>>>> which works Ok except that it's very slow (using JarFile).  I know
>>>>> that when deploy apps in Tomcat, I can specify it to not to unpack
>>>>> (|unpackWAR = "false").  However, Tomcat load and run the apps
>>>>> quickly. I looked into Tomcat source, the org.apache.catalina.loader
>>>>> package and could not find anything like that.  I see
>>>>> WebappClassLoader, but it seems to load from an unpacked war, not
>>>>> packed war.  Does Tomcat actually unpack the war before loading the
>>>>> app?  If not, could someone point me to the right place to look, or
>>>>> give some advice on how to write this thing faster?
>>>>>
>>>>> Thanks,
>>>>>
>>>>> -vd
>>>>> |
>>>>>
>>>>>       
>>>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [OT] How to write/use Tomcat's war classloader

Posted by David Smith <dn...@cornell.edu>.
Tomcat does unpack war files before starting the context. That's because 
of performance issues if it really tried to run the app from an archive. 
Typically if unpackWars="true", tomcat will unpack to the work directory 
instead of the webapps dir.

 --David

V D wrote:
> Thank you for your interest.  The application starts very slowly with 
> the war and my classloader (this is a standard app, not webapp).  The 
> war also has a webapp in it.  This has nothing to do with the 
> application logic.  It's the leading time to load the classes.  It 
> takes about 2 or 3 minutes.  The same JVM 1.5.0 runs Tomcat (5.5.12) 
> would response to request much quicker (about 10 seconds) after the 
> 1st request.  If I run the war file unpacked and using standard 
> classloader, it's a couple of seconds before things run.  However, 
> using our own class loader with the packed war (which searches all 
> libraries in the lib and classes in the classes directory) it takes 
> along time described above.
>
> My question is about how Tomcat does this in the unpacked war 
> scenario.  I couldn't find the Tomcat loader that does this.  I 
> suspect it unpacked it first, but this is a wild speculation.
>
>
> P Y wrote:
>> maybe you could give a bit more context to interpret "very slow" or 
>> "quickly".
>> like what version of tc and jvm are you using ... etc
>>
>>
>> On 4/12/06, V D <st...@drexel.edu> wrote:
>>  
>>> Anyone have an idea about this?
>>>
>>> V D wrote:
>>>    
>>>> We have a sizable war file (|unpacked|) that needs to be run in
>>>> certain way outside of Tomcat.  To do this, we created a classloader
>>>> which works Ok except that it's very slow (using JarFile).  I know
>>>> that when deploy apps in Tomcat, I can specify it to not to unpack
>>>> (|unpackWAR = "false").  However, Tomcat load and run the apps
>>>> quickly. I looked into Tomcat source, the org.apache.catalina.loader
>>>> package and could not find anything like that.  I see
>>>> WebappClassLoader, but it seems to load from an unpacked war, not
>>>> packed war.  Does Tomcat actually unpack the war before loading the
>>>> app?  If not, could someone point me to the right place to look, or
>>>> give some advice on how to write this thing faster?
>>>>
>>>> Thanks,
>>>>
>>>> -vd
>>>> |
>>>>
>>>>       
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>>
>>>     
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>   
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [OT] How to write/use Tomcat's war classloader

Posted by V D <st...@drexel.edu>.
Thank you for your interest.  The application starts very slowly with 
the war and my classloader (this is a standard app, not webapp).  The 
war also has a webapp in it.  This has nothing to do with the 
application logic.  It's the leading time to load the classes.  It takes 
about 2 or 3 minutes.  The same JVM 1.5.0 runs Tomcat (5.5.12) would 
response to request much quicker (about 10 seconds) after the 1st 
request.  If I run the war file unpacked and using standard classloader, 
it's a couple of seconds before things run.  However, using our own 
class loader with the packed war (which searches all libraries in the 
lib and classes in the classes directory) it takes along time described 
above.

My question is about how Tomcat does this in the unpacked war scenario.  
I couldn't find the Tomcat loader that does this.  I suspect it unpacked 
it first, but this is a wild speculation.


P Y wrote:
> maybe you could give a bit more context to interpret "very slow" or "quickly".
> like what version of tc and jvm are you using ... etc
>
>
> On 4/12/06, V D <st...@drexel.edu> wrote:
>   
>> Anyone have an idea about this?
>>
>> V D wrote:
>>     
>>> We have a sizable war file (|unpacked|) that needs to be run in
>>> certain way outside of Tomcat.  To do this, we created a classloader
>>> which works Ok except that it's very slow (using JarFile).  I know
>>> that when deploy apps in Tomcat, I can specify it to not to unpack
>>> (|unpackWAR = "false").  However, Tomcat load and run the apps
>>> quickly. I looked into Tomcat source, the org.apache.catalina.loader
>>> package and could not find anything like that.  I see
>>> WebappClassLoader, but it seems to load from an unpacked war, not
>>> packed war.  Does Tomcat actually unpack the war before loading the
>>> app?  If not, could someone point me to the right place to look, or
>>> give some advice on how to write this thing faster?
>>>
>>> Thanks,
>>>
>>> -vd
>>> |
>>>
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>>     
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [OT] How to write/use Tomcat's war classloader

Posted by P Y <py...@gmail.com>.
maybe you could give a bit more context to interpret "very slow" or "quickly".
like what version of tc and jvm are you using ... etc


On 4/12/06, V D <st...@drexel.edu> wrote:
>
> Anyone have an idea about this?
>
> V D wrote:
> >
> > We have a sizable war file (|unpacked|) that needs to be run in
> > certain way outside of Tomcat.  To do this, we created a classloader
> > which works Ok except that it's very slow (using JarFile).  I know
> > that when deploy apps in Tomcat, I can specify it to not to unpack
> > (|unpackWAR = "false").  However, Tomcat load and run the apps
> > quickly. I looked into Tomcat source, the org.apache.catalina.loader
> > package and could not find anything like that.  I see
> > WebappClassLoader, but it seems to load from an unpacked war, not
> > packed war.  Does Tomcat actually unpack the war before loading the
> > app?  If not, could someone point me to the right place to look, or
> > give some advice on how to write this thing faster?
> >
> > Thanks,
> >
> > -vd
> > |
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [OT] How to write/use Tomcat's war classloader

Posted by V D <st...@drexel.edu>.
Anyone have an idea about this?

V D wrote:
>
> We have a sizable war file (|unpacked|) that needs to be run in 
> certain way outside of Tomcat.  To do this, we created a classloader 
> which works Ok except that it's very slow (using JarFile).  I know 
> that when deploy apps in Tomcat, I can specify it to not to unpack 
> (|unpackWAR = "false").  However, Tomcat load and run the apps 
> quickly. I looked into Tomcat source, the org.apache.catalina.loader 
> package and could not find anything like that.  I see 
> WebappClassLoader, but it seems to load from an unpacked war, not 
> packed war.  Does Tomcat actually unpack the war before loading the 
> app?  If not, could someone point me to the right place to look, or 
> give some advice on how to write this thing faster?
>
> Thanks,
>
> -vd
> |
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [OT] How to write/use Tomcat's war classloader

Posted by V D <st...@drexel.edu>.
>
> We have a sizable war file (|unpacked|) that needs to be run in 
> certain way outside of Tomcat.  To do this, we created a

Correction: (unpacked -> packed)

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org