Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Reloading Application

 
Chandra Sekhar
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
somkiat puisungnoen
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65229
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
Alvin chew
Ranch Hand
Posts: 834
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Chandra Sekhar
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic