Solved

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

Posted on 2006-06-19
7
478 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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Resolve DNS query failed errors for Exchange
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

705 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now