Solved

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

Posted on 2006-06-19
7
515 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
[X]
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
  • 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
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 

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

Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

Question has a verified solution.

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

Suggested Solutions

A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
This article shows the method of using the Resultant Set of Policy Tool to locate Group Policy that applies a particular setting.
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

751 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