aspose file tools*
The moose likes Tomcat and the fly likes Reloading Application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Reloading Application" Watch "Reloading Application" New topic
Author

Reloading Application

Chandra Sekhar
Ranch Hand

Joined: Sep 26, 2003
Posts: 90
Hi,

In my application each time I change my servlet ,tomcat needs to be restarted.Can this be avoided?

I tried to set the parameter reloadable=�true�,but that seems not working.

<Context path=�/myapp� docBase=�webapps/examples� debug=�0� reloadable=�false�
</Context>

Is it possible to reload the application with out restarting the server.Something similar to hot deployement in JBoss

Rgds
Chandrasekhar


"Luck is when opportunity meets preparation"
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
Originally posted by Chandrasekhar S:
Hi,

In my application each time I change my servlet ,tomcat needs to be restarted.Can this be avoided?

I tried to set the parameter reloadable=�true�,but that seems not working.

<Context path=�/myapp� docBase=�webapps/examples� debug=�0� reloadable=�false�
</Context>

Is it possible to reload the application with out restarting the server.Something similar to hot deployement in JBoss

Rgds
Chandrasekhar



In tomcat 5.x , you can reload web application without restart tomcat server.

You can use Tomcat Managet for reload your web application ::

URL : http://<your hostname> ort/manager/html

Example : http://localhost:8080/manager/html


SCJA,SCJP,SCWCD,SCBCD,SCEA I
Java Developer, Thailand
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61424
    
  67

The 'manager' is also available in Tomcat 4.

Which version are you using? Some versions of Tomcat 4 have reportedly had problems with reloadable apps (and there is a patch I believe).


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Alvin chew
Ranch Hand

Joined: Jan 08, 2004
Posts: 834
hi, i just been told by mr.Budi Kurniawan , it can do some setting to fix this


For rapid development, thought, you might not want to stop and restart Tomcat. What you need is the feature that automatically reloads the application when one of the classes or the web.xml file changes. Here is how you can configure Tomcat for a given application:

<Context path="/myApp" docBase="myApp" debug="8" reloadable="true"/>


By default, the background thread checks any new/modified file every 15 seconds. That's too long for some people, including me. I normally like to make it 7. Here is how:

<Context path="/myApp" docBase="/myapp" debug="8" reloadable="true">
<Loader className="org.apache.catalina.loader.WebappLoader" reloadable="true" checkInterval="7" debug="7"/>
</Context>

I've also written a loader for Struts development, which reloads the application if the struts-config.xml changes. You can download it from the book's website.
--------------------

Author of How Tomcat Works



[ September 16, 2004: Message edited by: Alvin chew ]
Chandra Sekhar
Ranch Hand

Joined: Sep 26, 2003
Posts: 90
Hi,

Thank you all for the reply..

Infact I'm using Tomcat 5.I used the manager to reload my application.But when I worked with JBoss for Bean Deployement ,the moment I put the new ear file,it will get deployed.I was thinking something similar is possible in Tomcat .Now i'll try this

<Context path="/myApp" docBase="/myapp" debug="8" reloadable="true">
<Loader className="org.apache.catalina.loader.WebappLoader" reloadable="true" checkInterval="7" debug="7"/>
</Context>

Thanks again
Chandrasekhar
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
Originally posted by Bear Bibeault:
The 'manager' is also available in Tomcat 4.

Which version are you using? Some versions of Tomcat 4 have reportedly had problems with reloadable apps (and there is a patch I believe).


I'm using Tomcat 5.0.16.
Chandra Sekhar
Ranch Hand

Joined: Sep 26, 2003
Posts: 90
Hi

Modified my server.xml like this.(Tomcat version:jakarta-tomcat-5.0.18)

<Context path="/uat" docBase="uat" debug="0" reloadable="true">
<Loader className="org.apache.catalina.loader.WebappLoader" reloadable="true" checkInterval="5" debug="7"/>

But seems its not working .Did I miss something

Chandrasekhar S.
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
Originally posted by Chandrasekhar S:
Hi

Modified my server.xml like this.(Tomcat version:jakarta-tomcat-5.0.18)

<Context path="/uat" docBase="uat" debug="0" reloadable="true">
<Loader className="org.apache.catalina.loader.WebappLoader" reloadable="true" checkInterval="5" debug="7"/>

But seems its not working .Did I miss something

Chandrasekhar S.


When i'm change some java code and deploy class to webapp, Nothing change.

But i'm try another solution


Result : I'm found ClassCastException.
Budi Kurniawan
author
Greenhorn

Joined: Sep 15, 2004
Posts: 12
Originally posted by Chandrasekhar S:
Hi,

In my application each time I change my servlet ,tomcat needs to be restarted.Can this be avoided?

I tried to set the parameter reloadable=�true�,but that seems not working.

<Context path=�/myapp� docBase=�webapps/examples� debug=�0� reloadable=�false�
</Context>

Is it possible to reload the application with out restarting the server.Something similar to hot deployement in JBoss

Rgds
Chandrasekhar




The value of the docBase attribute does not seem to be correct to me. It's relative to the webapps directory, so it should be "example". also, reloadable must be true.


Author of <a href="http://www.amazon.com/exec/obidos/ASIN/097521280X/ref=jranch-20" target="_blank" rel="nofollow">How Tomcat Works</a>
Chandra Sekhar
Ranch Hand

Joined: Sep 26, 2003
Posts: 90
Hi

Modified my server.xml like this.(Tomcat version:jakarta-tomcat-5.0.18)

<Context path="/uat" docBase="uat" debug="0" reloadable="true">
<Loader className="org.apache.catalina.loader.WebappLoader" reloadable="true" checkInterval="5" debug="7"/>

But seems its not working .Did I miss something

Chandrasekhar S.
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Chandrasekhar S,

Welcome to JavaRanch!

We ain't got many rules 'round these parts, but we do got one. Please change your display name to comply with The JavaRanch Naming Policy.

We request something more than a single letter for the displayed last name.

Thanks Pardner! Hope to see you 'round the Ranch!


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Reloading Application