Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Configuring Tomcat server to use updated class files without restarting the server

Posted on 2006-06-19
7
502 Views
Last Modified: 2013-11-24
Is there any way to configure Tomcat to use updated class files with restarting the server? The main point is that if I create a new version of the class file and then FTP this version to the correct directory on the server, the server apparently continues to use the older version of the class file. One way to solve this is by refreshing the server. However, we do not want to refresh the server as this may cause complications for clients who are already connected. Is there any way to accomplish this without refreshing the server?
0
Comment
Question by:pr12
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 16

Expert Comment

by:suprapto45
ID: 16939135
As far as I know, you need to restart Tomcat. If it is JSP files then you may not need to restart Tomcat.

One way you can do is to design your architecture as cluster where multiple Tomcat servers are involved. Hence if one Tomcat is shut down, the rest of the servers are not affected. Then once the server has been updated, you can put it back online and restart the rest of the servers.

David
0
 
LVL 8

Expert Comment

by:kaliyugkaarjun
ID: 16940928
Its not possible according to my knowledge..U need to restart tomcat fora single line or word of  change in any jsp file.  Such a facility is available in Weblogic server which is third party compenent that helps to detect changed files to avoide  restart.
But no such facility available in tomcat yet.
0
 
LVL 4

Expert Comment

by:Yagantappa
ID: 16941094
You need to turn on Servlet Reloading on your Tomcat.
[While the below works, for Tomcat 4 another answer is simply to add the attribute reloadable="true" to the Context element for that webapp. Sometimes you don't want all contexts to be reloadable.]

To turn on servlet reloading, edit install_dir/conf/server.xml and add a DefaultContext subelement to the main Service element and supply true for the reloadable attribute. The easiest way to do this is to find the following comment:

<!-- Define properties for each web application. This is only needed if you want to set non-default properties, or have web application document roots in places other than the virtual host's appBase directory. -->

and insert the following line just below it: <DefaultContext reloadable="true"/>

Be sure to make a backup copy of server.xml before making the above change.

In addition, in case you wish to specify reloading after a certain interval add the following attributes also to the server.xml:
<Loader className="org.apache.catalina.loader.WebappLoader" loaderClass="org.apache.catalina.loader.WebappClassLoader" checkInterval="3" />

By default reload takes place every 15 seconds. The above object should be placed with in the Context element of your web-application.
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 

Author Comment

by:pr12
ID: 16942444
Thanks for all the replies. They are very useful. Yagantappa, the technique you have listed, is it useful for reloading the servlets alone or can I use for normal java classes as well?
0
 
LVL 4

Accepted Solution

by:
Yagantappa earned 150 total points
ID: 16942780
It should work for all java class files.
0
 

Author Comment

by:pr12
ID: 16945434
I have it working, thanks for your help.
0
 
LVL 16

Expert Comment

by:suprapto45
ID: 16948174
Wow,

I really learn something new too :)

David
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Last week, our Skyport webinar on “How to secure your Active Directory” (https://www.experts-exchange.com/videos/5810/Webinar-Is-Your-Active-Directory-as-Secure-as-You-Think.html?cid=Gene_Skyport) provided 218 attendees with a step-by-step guide for…
In-place Upgrading Dirsync to Azure AD Connect
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…

790 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question