Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Restart tomcat when a class file is changed?

Tags:

Why do we need to restart a tomcat server whenever a class file is changed, is there no other way?

like image 988
flash Avatar asked Dec 09 '09 13:12

flash


People also ask

How do I restart Tomcat?

To restart Apache Tomcat on Microsoft WindowsOn a command prompt, type services. msc . Right-click Apache Tomcat Tomcat6, and click Restart.

Why do I need to restart Tomcat?

Restarting the Tomcat server is also a way to stop and restart your applications, which allows elements such as web. xml files to be reloaded (although there are ways of reloading these files without stopping the server).

How does Tomcat shutdown work?

It simply means giving the process a chance to terminate normally (i.e. using a regular kill command with default TERM signal). The JVM can catch this signal and perform regular shutdown. The command is sent immediately from catalina.sh without delay.


1 Answers

You can configure Tomcat and make your webapp "reloadable". To do so, add reloadable=true to the <Context> element of your webapp. About the reloadable attribute, the documentation says:

Set to true if you want Catalina to monitor classes in /WEB-INF/classes/ and /WEB-INF/lib for changes, and automatically reload the web application if a change is detected. This feature is very useful during application development, but it requires significant runtime overhead and is not recommended for use on deployed production applications. That's why the default setting for this attribute is false. You can use the Manager web application, however, to trigger reloads of deployed applications on demand.

like image 118
Pascal Thivent Avatar answered Oct 08 '22 05:10

Pascal Thivent