Modifying Java files does not need to restart the Tomcat service __java

Source: Internet
Author: User
You can modify a class without restarting Tomcat to load the entire project (started manually)
1. Configure Reloadable=true (auto overload)
2. Use the debug mode, provided that it is limited to local modifications. (Modify class does not need to reboot--Gegacay)
When you use Eclipse+tomcat to develop Java projects, you often encounter situations where the modified Java file Tomcat automatically restarts, followed by a lengthy wait service reboot. In fact, most of the Java file modification is not necessary to restart the service, only some specific Java files, such as only the restart service when the Java code will need to restart the service.
Re-deploy as soon as the Java code is modified (the console has a clear hint), and the session fails, setting the server to debug mode (debug _disibledevent=>tomcat stops the Web app and frees the memory, and then reloads the Web App. This is really a time-consuming project. If you can have only a few classes to overload the functionality, will greatly satisfy me this instant debugging mania.
1. Modify class does not reboot Tomcat (no manual reboot)
First you need to set the context reloadable= "true" in Server.xml, true to overload (not reboot!), false manual overload. (If the project is in Tomcat, you should go to the Tomcat directory setting.) )
Eclipse EE settings, File settings: Server.xml > reloadable= "false" interface settings: Server > Modules > Edit > WebApp > Auto Reloading Enabled > False
The development phase is usually set to true to facilitate development and should be set to false during the release phase, increasing the speed of application access. You can choose to remove other unrelated items from the WebApps first, so that the number of Tomcat-loaded items is less, and the corresponding is fast.
2. There are two ways to modify a class without restarting Tomcat: Thermal deployment, thermal loading
Hot deploy: The container state deploys the entire project at run time. In this case, the general memory will be emptied and reloaded, which may result in sessin loss and so on. Tomcat 6 is really hot to deploy and the session is not lost.
Gegas: It is best to use it during debugging, lest the whole project be loaded and the debug mode supports thermal loading. The container state reloads the compiled class at run time. In this case, the memory will not be emptied and the sessin will not be lost, but it can easily cause a memory overflow or cannot find a method.
General changes in the structure and model of the class will be abnormal, in the existing variables and methods of change is not a problem (Eclipse, MyEclipse8, JBuilder, IntelliJ idea ...).
3. Automatically compile JSP
Build automatically
modifying Tomcat source code implementation realoadable! not recommended
Specific actions:
There are two ways to modify Java code without restarting the service:
1. Modify Tomcat configuration file (Tomcat-5.5.20\conf\catalina\localhost directory)
Add reloadable= "false" in configuration
<context path= "/"
Reloadable= "false"
Docbase= "F:\workspace\shpm3\shpm3-web"
Workdir= "F:\workspace\shpm3\work"/>
2, can also be set up through eclipse to implement the above configuration file changes
Eclipse's project name right-click: properties-> Tomcat->general->make This context as reloadable (reloadable= "true") do not select
Eclipse's Engineering name right-click: Tomcat project->update Context Definition

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.