You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by santa T <sh...@gmail.com> on 2007/07/10 02:18:09 UTC

How to replace jar which was already loaded?

Hi
  I have a "worker.jar" in my webapp. User could upload a new "worker.jar"
replacing it. And I don't want to restart the tomcat.
  How can I implement this?

Thanks.

Re: How to replace jar which was already loaded?

Posted by Manivannan Palanichamy <ma...@gmail.com>.
Try manager url,
http://localhost:8080/manager/reload?path=/app_name
(app_name is your web application name.
). it will reload the specific application alone.

You will be prompted for manager login, which you have already
configured in <tomcat>/conf/tomcat-users.xml


-- 
Manivannan.Palanichamy (@) Oracle.com
http://mani.gw.googlepages.com/index.html


On 7/10/07, santa T <sh...@gmail.com> wrote:
>
> Hi
>   I have a "worker.jar" in my webapp. User could upload a new "worker.jar"
> replacing it. And I don't want to restart the tomcat.
>   How can I implement this?
>
> Thanks.
>



-- 
Manivannan.Palanichamy (@) Oracle.com
http://mani.gw.googlepages.com/index.html

Re: How to replace jar which was already loaded?

Posted by santa T <sh...@gmail.com>.
Thanks

2007/7/10, David Delbecq <de...@oma.be>:
>
> http://tomcat.apache.org/tomcat-5.5-doc/config/context.html
>
> --
> reloadable
>
> Set to true if you want Catalina to monitor classes in /WEB-INF/classes/
> and /WEB-INF/lib for changes, and automatically reload the web
> application if a change is detected. This feature is very useful during
> application development, but it requires significant runtime overhead
> and is not recommended for use on deployed production applications.
> That's why the default setting for this attribute is false. You can use
> the Manager web application, however, to trigger reloads of deployed
> applications on demand.
> --
> So all you have to do is ensure timestamps are updated in
> WEB-INF/lib/worker.jar
>
>
> En l'instant précis du 10/07/07 02:18, santa T s'exprimait en ces termes:
> > Hi
> >  I have a "worker.jar" in my webapp. User could upload a new "worker.jar
> "
> > replacing it. And I don't want to restart the tomcat.
> >  How can I implement this?
> >
> > Thanks.
> >
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: How to replace jar which was already loaded?

Posted by David Delbecq <de...@oma.be>.
http://tomcat.apache.org/tomcat-5.5-doc/config/context.html

--
reloadable   

Set to true if you want Catalina to monitor classes in /WEB-INF/classes/
and /WEB-INF/lib for changes, and automatically reload the web
application if a change is detected. This feature is very useful during
application development, but it requires significant runtime overhead
and is not recommended for use on deployed production applications.
That's why the default setting for this attribute is false. You can use
the Manager web application, however, to trigger reloads of deployed
applications on demand.
--
So all you have to do is ensure timestamps are updated in
WEB-INF/lib/worker.jar


En l'instant précis du 10/07/07 02:18, santa T s'exprimait en ces termes:
> Hi
>  I have a "worker.jar" in my webapp. User could upload a new "worker.jar"
> replacing it. And I don't want to restart the tomcat.
>  How can I implement this?
>
> Thanks.
>


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


Re: How to replace jar which was already loaded?

Posted by Pid <p...@pidster.com>.
In your Context definition you can state which files should be watched 
for changes.

<WatchedResource>WEB-INF/web.xml</WatchedResource>
<WatchedResource>WEB-INF/lib/worker.jar</WatchedResource>

p

hanasaki wrote:
> If you go this way... remember the following
> 
> ClassLoader cl1 = new URLClassLoader(urls);
> Class cls1 = cl1.loadClass("classPath");
> 
> ClassLoader cl2 = new URLClassLoader(urls);
> Class cls2 = cl2.loadClass("classPath");
> 
> cls1 == cls2 <=== FALSE not TRUE as you might expect
> 
> Johnny Kewl wrote:
>> This is the kind of thing tomcat cant really do for you.... and it
>> depends very much on the sophistication needed.
>> One dirty trick, is to change the web.xml file slightly, when TC gets a
>> little quiet time it will reload the whole web app, ie when its able to
>> shed all classes.... dont really recommend it, but I have used it in the
>> past.
>>
>> More sophisticated method is to read up on
>> ClassLoader cl = new URLClassLoader(urls);
>> Class cls = cl.loadClass("classPath");
>> ie your program determines when it needs the new class, could do this by
>> checking the last modified time of the file attribute....
>>
>> have fun
>>
>>
>>
>> ----- Original Message ----- From: "santa T" <sh...@gmail.com>
>> To: <us...@tomcat.apache.org>
>> Sent: Tuesday, July 10, 2007 2:18 AM
>> Subject: How to replace jar which was already loaded?
>>
>>
>>> Hi
>>>  I have a "worker.jar" in my webapp. User could upload a new "worker.jar"
>>> replacing it. And I don't want to restart the tomcat.
>>>  How can I implement this?
>>>
>>> Thanks.
>>>
>>
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 


Re: How to replace jar which was already loaded?

Posted by hanasaki <ha...@hanaden.com>.
If you go this way... remember the following

ClassLoader cl1 = new URLClassLoader(urls);
Class cls1 = cl1.loadClass("classPath");

ClassLoader cl2 = new URLClassLoader(urls);
Class cls2 = cl2.loadClass("classPath");

cls1 == cls2 <=== FALSE not TRUE as you might expect

Johnny Kewl wrote:
> 
> This is the kind of thing tomcat cant really do for you.... and it
> depends very much on the sophistication needed.
> One dirty trick, is to change the web.xml file slightly, when TC gets a
> little quiet time it will reload the whole web app, ie when its able to
> shed all classes.... dont really recommend it, but I have used it in the
> past.
> 
> More sophisticated method is to read up on
> ClassLoader cl = new URLClassLoader(urls);
> Class cls = cl.loadClass("classPath");
> ie your program determines when it needs the new class, could do this by
> checking the last modified time of the file attribute....
> 
> have fun
> 
> 
> 
> ----- Original Message ----- From: "santa T" <sh...@gmail.com>
> To: <us...@tomcat.apache.org>
> Sent: Tuesday, July 10, 2007 2:18 AM
> Subject: How to replace jar which was already loaded?
> 
> 
>> Hi
>>  I have a "worker.jar" in my webapp. User could upload a new "worker.jar"
>> replacing it. And I don't want to restart the tomcat.
>>  How can I implement this?
>>
>> Thanks.
>>
> 
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 

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


Re: How to replace jar which was already loaded?

Posted by Johnny Kewl <jo...@kewlstuff.co.za>.
This is the kind of thing tomcat cant really do for you.... and it depends 
very much on the sophistication needed.
One dirty trick, is to change the web.xml file slightly, when TC gets a 
little quiet time it will reload the whole web app, ie when its able to shed 
all classes.... dont really recommend it, but I have used it in the past.

More sophisticated method is to read up on
ClassLoader cl = new URLClassLoader(urls);
Class cls = cl.loadClass("classPath");
ie your program determines when it needs the new class, could do this by 
checking the last modified time of the file attribute....

have fun



----- Original Message ----- 
From: "santa T" <sh...@gmail.com>
To: <us...@tomcat.apache.org>
Sent: Tuesday, July 10, 2007 2:18 AM
Subject: How to replace jar which was already loaded?


> Hi
>  I have a "worker.jar" in my webapp. User could upload a new "worker.jar"
> replacing it. And I don't want to restart the tomcat.
>  How can I implement this?
>
> Thanks.
> 


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